App Platform: Remove mutable globals (#102962)

* App Platform: Remove mutable globals

* chore: clarify why this exists

* fix: support multi-tenant mode

* refactor: call builder providers directly

* CI: Force re-build
This commit is contained in:
Mariell Hoversholm
2025-03-27 15:46:09 +01:00
committed by GitHub
parent 031a047565
commit d0d7078953
29 changed files with 199 additions and 108 deletions
+3 -2
View File
@@ -91,6 +91,7 @@ func ProvideService(
resourceClient resource.ResourceClient,
dual dualwrite.Service,
sorter sort.Service,
restConfig apiserver.RestConfigProvider,
) *Service {
srv := &Service{
log: slog.Default().With("logger", "folder-service"),
@@ -118,7 +119,7 @@ func ProvideService(
dual,
request.GetNamespaceMapper(cfg),
v0alpha1.FolderResourceInfo.GroupVersionResource(),
apiserver.GetRestConfig,
restConfig.GetRestConfig,
dashboardStore,
userService,
resourceClient,
@@ -136,7 +137,7 @@ func ProvideService(
dual,
request.GetNamespaceMapper(cfg),
dashboardalpha1.DashboardResourceInfo.GroupVersionResource(),
apiserver.GetRestConfig,
restConfig.GetRestConfig,
dashboardStore,
userService,
resourceClient,
@@ -29,6 +29,7 @@ import (
"github.com/grafana/grafana/pkg/services/accesscontrol/acimpl"
"github.com/grafana/grafana/pkg/services/accesscontrol/actest"
acmock "github.com/grafana/grafana/pkg/services/accesscontrol/mock"
"github.com/grafana/grafana/pkg/services/apiserver"
"github.com/grafana/grafana/pkg/services/apiserver/client"
"github.com/grafana/grafana/pkg/services/dashboards"
"github.com/grafana/grafana/pkg/services/dashboards/dashboardaccess"
@@ -71,7 +72,8 @@ func TestIntegrationProvideFolderService(t *testing.T) {
store := ProvideStore(db)
ProvideService(
store, ac, bus.ProvideBus(tracing.InitializeTracerForTest()),
nil, nil, nil, db, featuremgmt.WithFeatures(), supportbundlestest.NewFakeBundleService(), nil, cfg, nil, tracing.InitializeTracerForTest(), nil, dualwrite.ProvideTestService(), sort.ProvideService())
nil, nil, nil, db, featuremgmt.WithFeatures(), supportbundlestest.NewFakeBundleService(), nil, cfg, nil, tracing.InitializeTracerForTest(), nil, dualwrite.ProvideTestService(), sort.ProvideService(),
apiserver.WithoutRestConfig)
require.Len(t, ac.Calls.RegisterAttributeScopeResolver, 2)
})