Files
grafana/pkg/services/publicdashboards/service/common_test.go
T
Jeff Levin a21a232a8e Revert read replica POC (#93551)
* Revert "chore: add replDB to team service (#91799)"

This reverts commit c6ae2d7999.

* Revert "experiment: use read replica for Get and Find Dashboards (#91706)"

This reverts commit 54177ca619.

* Revert "QuotaService: refactor to use ReplDB for Get queries (#91333)"

This reverts commit 299c142f6a.

* Revert "refactor replCfg to look more like plugins/plugin config (#91142)"

This reverts commit ac0b4bb34d.

* Revert "chore (replstore): fix registration with multiple sql drivers, again (#90990)"

This reverts commit daedb358dd.

* Revert "Chore (sqlstore): add validation and testing for repl config (#90683)"

This reverts commit af19f039b6.

* Revert "ReplStore: Add support for round robin load balancing between multiple read replicas (#90530)"

This reverts commit 27b52b1507.

* Revert "DashboardStore: Use ReplDB and get dashboard quotas from the ReadReplica (#90235)"

This reverts commit 8a6107cd35.

* Revert "accesscontrol service read replica (#89963)"

This reverts commit 77a4869fca.

* Revert "Fix: add mapping for the new mysqlRepl driver (#89551)"

This reverts commit ab5a079bcc.

* Revert "fix: sql instrumentation dual registration error (#89508)"

This reverts commit d988f5c3b0.

* Revert "Experimental Feature Toggle: databaseReadReplica (#89232)"

This reverts commit 50244ed4a1.
2024-09-25 15:21:39 -08:00

55 lines
2.0 KiB
Go

package service
import (
"testing"
"github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/tracing"
"github.com/grafana/grafana/pkg/services/annotations"
"github.com/grafana/grafana/pkg/services/annotations/annotationsimpl"
"github.com/grafana/grafana/pkg/services/dashboards"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/licensing/licensingtest"
"github.com/grafana/grafana/pkg/services/publicdashboards"
"github.com/grafana/grafana/pkg/services/publicdashboards/database"
. "github.com/grafana/grafana/pkg/services/publicdashboards/models"
"github.com/grafana/grafana/pkg/services/publicdashboards/service/intervalv2"
"github.com/grafana/grafana/pkg/services/tag/tagimpl"
"github.com/grafana/grafana/pkg/setting"
)
func newPublicDashboardServiceImpl(
t *testing.T,
publicDashboardStore publicdashboards.Store,
dashboardService dashboards.DashboardService,
annotationsRepo annotations.Repository,
) (*PublicDashboardServiceImpl, db.DB, *setting.Cfg) {
t.Helper()
db, cfg := db.InitTestDBWithCfg(t)
tagService := tagimpl.ProvideService(db)
if annotationsRepo == nil {
annotationsRepo = annotationsimpl.ProvideService(db, cfg, featuremgmt.WithFeatures(), tagService, tracing.InitializeTracerForTest(), nil)
}
if publicDashboardStore == nil {
publicDashboardStore = database.ProvideStore(db, cfg, featuremgmt.WithFeatures())
}
serviceWrapper := ProvideServiceWrapper(publicDashboardStore)
license := licensingtest.NewFakeLicensing()
license.On("FeatureEnabled", FeaturePublicDashboardsEmailSharing).Return(false)
return &PublicDashboardServiceImpl{
AnnotationsRepo: annotationsRepo,
log: log.New("test.logger"),
intervalCalculator: intervalv2.NewCalculator(),
dashboardService: dashboardService,
store: publicDashboardStore,
serviceWrapper: serviceWrapper,
license: license,
features: featuremgmt.WithFeatures(),
}, db, cfg
}