DashboardStore: Use ReplDB and get dashboard quotas from the ReadReplica (#90235)
* Use ReplDB in dashboard store and update all fixtures - no other changes * just moving dashboard counts for now * find the missing test fixture
This commit is contained in:
@@ -23,15 +23,15 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationDashboardFolderStore(t *testing.T) {
|
||||
var sqlStore db.DB
|
||||
var sqlStore db.ReplDB
|
||||
var cfg *setting.Cfg
|
||||
var dashboardStore dashboards.Store
|
||||
|
||||
setup := func() {
|
||||
sqlStore, cfg = db.InitTestDBWithCfg(t)
|
||||
sqlStore, cfg = db.InitTestReplDBWithCfg(t)
|
||||
quotaService := quotatest.New(false, nil)
|
||||
var err error
|
||||
dashboardStore, err = database.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(featuremgmt.FlagPanelTitleSearch), tagimpl.ProvideService(sqlStore), quotaService)
|
||||
dashboardStore, err = database.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(featuremgmt.FlagPanelTitleSearch), tagimpl.ProvideService(sqlStore.DB()), quotaService)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
t.Run("Given dashboard and folder with the same title", func(t *testing.T) {
|
||||
|
||||
@@ -418,7 +418,7 @@ func TestIntegrationNestedFolderService(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
db, cfg := sqlstore.InitTestDB(t)
|
||||
db, cfg := sqlstore.InitTestReplDB(t)
|
||||
quotaService := quotatest.New(false, nil)
|
||||
folderStore := ProvideDashboardFolderStore(db)
|
||||
|
||||
@@ -823,7 +823,7 @@ func TestFolderServiceDualWrite(t *testing.T) {
|
||||
guardian.New = g
|
||||
})
|
||||
|
||||
db, _ := sqlstore.InitTestDB(t)
|
||||
db, _ := sqlstore.InitTestReplDB(t)
|
||||
cfg := setting.NewCfg()
|
||||
features := featuremgmt.WithFeatures()
|
||||
nestedFolderStore := ProvideStore(db)
|
||||
@@ -1378,7 +1378,7 @@ func TestIntegrationNestedFolderSharedWithMe(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
db, cfg := sqlstore.InitTestDB(t)
|
||||
db, cfg := sqlstore.InitTestReplDB(t)
|
||||
quotaService := quotatest.New(false, nil)
|
||||
folderStore := ProvideDashboardFolderStore(db)
|
||||
|
||||
@@ -1781,7 +1781,7 @@ func TestIntegrationNestedFolderSharedWithMe(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFolderServiceGetFolder(t *testing.T) {
|
||||
db, _ := sqlstore.InitTestDB(t)
|
||||
db, _ := sqlstore.InitTestReplDB(t)
|
||||
|
||||
signedInAdminUser := user.SignedInUser{UserID: 1, OrgID: orgID, Permissions: map[int64]map[string][]string{
|
||||
orgID: {
|
||||
@@ -1880,7 +1880,7 @@ func TestFolderServiceGetFolder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFolderServiceGetFolders(t *testing.T) {
|
||||
db, cfg := sqlstore.InitTestDB(t)
|
||||
db, cfg := sqlstore.InitTestReplDB(t)
|
||||
quotaService := quotatest.New(false, nil)
|
||||
folderStore := ProvideDashboardFolderStore(db)
|
||||
|
||||
@@ -1955,7 +1955,7 @@ func TestFolderServiceGetFolders(t *testing.T) {
|
||||
// TODO replace it with an API test under /pkg/tests/api/folders
|
||||
// whenever the golang client with get updated to allow filtering child folders by permission
|
||||
func TestGetChildrenFilterByPermission(t *testing.T) {
|
||||
db, cfg := sqlstore.InitTestDB(t)
|
||||
db, cfg := sqlstore.InitTestReplDB(t)
|
||||
|
||||
signedInAdminUser := user.SignedInUser{UserID: 1, OrgID: orgID, Permissions: map[int64]map[string][]string{
|
||||
orgID: {
|
||||
|
||||
Reference in New Issue
Block a user