fleet/server/mdm/android/arch_test.go
Victor Lyuboslavsky 3d2171d2d9
Moved common endpointer packages to platform dir. (#37780)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #37192

- Move /server/service/middleware/endpoint_utils to
/server/platform/endpointer
- Move /server/service/middleware/authzcheck to
/server/platform/middleware/authzcheck
- Move /server/service/middleware/ratelimit to
/server/platform/middleware/ratelimit

# Checklist for submitter

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.

## Testing

- [x] Added/updated automated tests
- [x] QA'd all new/changed functionality manually


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **Refactor**
* Reorganized internal endpoint utilities to a centralized platform
location for improved code organization and maintainability. No
functional changes to existing features or APIs.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-01-06 14:23:07 -06:00

50 lines
1.6 KiB
Go

package android_test
import (
"regexp"
"testing"
"github.com/fleetdm/fleet/v4/server/archtest"
)
const m = archtest.ModuleName
// TestAllAndroidPackageDependencies checks that android packages are not dependent on other Fleet packages
// to maintain decoupling and modularity.
// If coupling is necessary, it should be done in the main server/fleet, server/service, or other package.
func TestAllAndroidPackageDependencies(t *testing.T) {
t.Parallel()
archtest.NewPackageTest(t, m+"/server/mdm/android...").
OnlyInclude(regexp.MustCompile(`^github\.com/fleetdm/`)).
ShouldNotDependOn(
m+"/server/service...",
m+"/server/datastore/mysql...",
).
IgnoreRecursively(
m+"/server/mdm/android/tests",
).
IgnoreDeps(
// Android packages
m+"/server/mdm/android...",
// Platform packages
m+"/server/platform...",
// Other/infra packages
m+"/server/datastore/mysql/common_mysql",
m+"/server/service/externalsvc", // dependency on Jira and Zendesk
m+"/server/service/middleware/auth",
m+"/server/service/middleware/log",
m+"/server/service/modules/activities",
).
Check()
}
// TestAndroidPackageDependencies checks that android package is NOT dependent on ANY other Fleet packages
// to maintain decoupling and modularity. This package should only contain basic structs and interfaces.
// If coupling is necessary, it should be done in the main server/fleet or another package.
func TestAndroidPackageDependencies(t *testing.T) {
t.Parallel()
archtest.NewPackageTest(t, m+"/server/mdm/android").
OnlyInclude(regexp.MustCompile(`^github\.com/fleetdm/`)).
ShouldNotDependOn(m + "/...").
Check()
}