Folders: Replace sql query with folder service call when collecting folder tree (#98443)

* Replace sql query with folder service call when collecting folder tree
* Update provider for folder service implementation for wire
* Refactor provisioning of oss service in folder permissions test util
This commit is contained in:
Arati R.
2025-01-07 09:53:09 +01:00
committed by GitHub
parent de9aec8e56
commit 6957e1f7b7
10 changed files with 56 additions and 28 deletions
@@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/infra/serverlock"
"github.com/grafana/grafana/pkg/infra/tracing"
@@ -23,6 +24,7 @@ import (
"github.com/grafana/grafana/pkg/services/guardian"
"github.com/grafana/grafana/pkg/services/quota/quotatest"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/grafana/grafana/pkg/services/supportbundles/supportbundlestest"
"github.com/grafana/grafana/pkg/services/tag/tagimpl"
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/setting"
@@ -87,10 +89,24 @@ func TestIntegrationDashboardServiceZanzana(t *testing.T) {
createDashboards(t, service, 100, "test-a")
createDashboards(t, service, 100, "test-b")
folderImplStore := folderimpl.ProvideStore(db)
folderService := folderimpl.ProvideService(
folderImplStore,
ac,
bus.ProvideBus(tracing.InitializeTracerForTest()),
dashboardStore,
folderStore,
db,
featuremgmt.WithFeatures(featuremgmt.FlagNestedFolders),
supportbundlestest.NewFakeBundleService(),
nil,
tracing.InitializeTracerForTest(),
)
// Sync Grafana DB with zanzana (migrate data)
tracer := tracing.InitializeTracerForTest()
lock := serverlock.ProvideService(db, tracer)
zanzanaSyncronizer := dualwrite.NewZanzanaReconciler(cfg, zclient, db, lock)
zanzanaSyncronizer := dualwrite.NewZanzanaReconciler(cfg, zclient, db, lock, folderService)
err = zanzanaSyncronizer.ReconcileSync(context.Background())
require.NoError(t, err)