fleet/server/mdm/android/arch_test.go
Victor Lyuboslavsky a0581a33cc
Converted old activity module into function. Cleaned up activity types. (#40752)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #38536

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

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

## 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

* **Refactor**
* Reorganized internal activity tracking infrastructure across services
to improve code maintainability and reduce complexity.

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

49 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",
).
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()
}