chore: replace sqlstore.Store with db.DB (#57010)

* chore: replace sqlstore.SQLStore with db.DB

* more post-sqlstore.SQLStore cleanup
This commit is contained in:
Kristin Laemmert
2022-10-14 15:33:06 -04:00
committed by GitHub
parent 2b4d57fe60
commit c61b5e85b4
59 changed files with 275 additions and 244 deletions
@@ -21,6 +21,7 @@ import (
"github.com/grafana/grafana/pkg/services/star/starimpl"
"github.com/grafana/grafana/pkg/services/tag/tagimpl"
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/setting"
)
func TestIntegrationDashboardDataAccess(t *testing.T) {
@@ -35,7 +36,7 @@ func TestIntegrationDashboardDataAccess(t *testing.T) {
setup := func() {
sqlStore = sqlstore.InitTestDB(t)
starService = starimpl.ProvideService(sqlStore, sqlStore.Cfg)
dashboardStore = ProvideDashboardStore(sqlStore, testFeatureToggles, tagimpl.ProvideService(sqlStore, sqlStore.Cfg))
dashboardStore = ProvideDashboardStore(sqlStore, sqlStore.Cfg, testFeatureToggles, tagimpl.ProvideService(sqlStore, sqlStore.Cfg))
savedFolder = insertTestDashboard(t, dashboardStore, "1 test dash folder", 1, 0, true, "prod", "webapp")
savedDash = insertTestDashboard(t, dashboardStore, "test dash 23", 1, savedFolder.Id, false, "prod", "webapp")
insertTestDashboard(t, dashboardStore, "test dash 45", 1, savedFolder.Id, false, "prod")
@@ -486,7 +487,9 @@ func TestIntegrationDashboardDataAccessGivenPluginWithImportedDashboards(t *test
t.Skip("skipping integration test")
}
sqlStore := sqlstore.InitTestDB(t)
dashboardStore := ProvideDashboardStore(sqlStore, testFeatureToggles, tagimpl.ProvideService(sqlStore, sqlStore.Cfg))
cfg := setting.NewCfg()
cfg.IsFeatureToggleEnabled = func(key string) bool { return false }
dashboardStore := ProvideDashboardStore(sqlStore, &setting.Cfg{}, testFeatureToggles, tagimpl.ProvideService(sqlStore, cfg))
pluginId := "test-app"
appFolder := insertTestDashboardForPlugin(t, dashboardStore, "app-test", 1, 0, true, pluginId)
@@ -508,7 +511,9 @@ func TestIntegrationDashboard_SortingOptions(t *testing.T) {
t.Skip("skipping integration test")
}
sqlStore := sqlstore.InitTestDB(t)
dashboardStore := ProvideDashboardStore(sqlStore, testFeatureToggles, tagimpl.ProvideService(sqlStore, sqlStore.Cfg))
cfg := setting.NewCfg()
cfg.IsFeatureToggleEnabled = func(key string) bool { return false }
dashboardStore := ProvideDashboardStore(sqlStore, &setting.Cfg{}, testFeatureToggles, tagimpl.ProvideService(sqlStore, cfg))
dashB := insertTestDashboard(t, dashboardStore, "Beta", 1, 0, false)
dashA := insertTestDashboard(t, dashboardStore, "Alfa", 1, 0, false)
@@ -557,7 +562,9 @@ func TestIntegrationDashboard_Filter(t *testing.T) {
t.Skip("skipping integration test")
}
sqlStore := sqlstore.InitTestDB(t)
dashboardStore := ProvideDashboardStore(sqlStore, testFeatureToggles, tagimpl.ProvideService(sqlStore, sqlStore.Cfg))
cfg := setting.NewCfg()
cfg.IsFeatureToggleEnabled = func(key string) bool { return false }
dashboardStore := ProvideDashboardStore(sqlStore, cfg, testFeatureToggles, tagimpl.ProvideService(sqlStore, cfg))
insertTestDashboard(t, dashboardStore, "Alfa", 1, 0, false)
dashB := insertTestDashboard(t, dashboardStore, "Beta", 1, 0, false)
qNoFilter := &models.FindPersistedDashboardsQuery{