mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
Resolves #37192 Separating generic endpoint_utils middleware logic from domain-specific business logic. New bounded contexts would share the generic logic and implement their own domain-specific logic. The two approaches used in this PR are: - Use common `platform` types - Use interfaces In the next PR we will move `endpointer_utils`, `authzcheck` and `ratelimit` into `platform` directory. # Checklist for submitter - [x] Added changes file ## Testing - [x] Added/updated tests - [x] QA'd all new/changed functionality manually <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Restructured internal error handling and context management to support bounded context architecture. * Improved error context collection and telemetry observability through a provider-based mechanism. * Decoupled licensing and authentication concerns into interfaces for better modularity. * **Chores** * Updated internal package dependencies to align with new architectural boundaries. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
51 lines
1.7 KiB
Go
51 lines
1.7 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...",
|
|
// 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/authzcheck",
|
|
m+"/server/service/middleware/endpoint_utils",
|
|
m+"/server/service/middleware/log",
|
|
m+"/server/service/middleware/ratelimit",
|
|
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()
|
|
}
|