Chore: Replace sqlstore with db interface (#85366)

* replace sqlstore with db interface in a few packages

* remove from stats

* remove sqlstore in admin test

* remove sqlstore from api plugin tests

* fix another createUser

* remove sqlstore in publicdashboards

* remove sqlstore from orgs

* clean up orguser test

* more clean up in sso

* clean up service accounts

* further cleanup

* more cleanup in accesscontrol

* last cleanup in accesscontrol

* clean up teams

* more removals

* split cfg from db in testenv

* few remaining fixes

* fix test with bus

* pass cfg for testing inside db as an option

* set query retries when no opts provided

* revert golden test data

* rebase and rollback
This commit is contained in:
Serge Zaitsev
2024-04-04 15:04:47 +02:00
committed by GitHub
parent c41b0a71cf
commit faa1244518
69 changed files with 507 additions and 465 deletions
@@ -41,13 +41,13 @@ func TestIntegrationAdminConfiguration_SendingToExternalAlertmanagers(t *testing
AppModeProduction: true,
})
grafanaListedAddr, s := testinfra.StartGrafana(t, dir, path)
grafanaListedAddr, env := testinfra.StartGrafanaEnv(t, dir, path)
orgService, err := orgimpl.ProvideService(s, s.Cfg, quotatest.New(false, nil))
orgService, err := orgimpl.ProvideService(env.SQLStore, env.Cfg, quotatest.New(false, nil))
require.NoError(t, err)
// Create a user to make authenticated requests
userID := createUser(t, s, user.CreateUserCommand{
userID := createUser(t, env.SQLStore, env.Cfg, user.CreateUserCommand{
DefaultOrgRole: string(org.RoleAdmin),
Login: "grafana",
Password: "password",
@@ -63,7 +63,7 @@ func TestIntegrationAdminConfiguration_SendingToExternalAlertmanagers(t *testing
require.Equal(t, disableOrgID, orgID)
// create user under different organisation
createUser(t, s, user.CreateUserCommand{
createUser(t, env.SQLStore, env.Cfg, user.CreateUserCommand{
DefaultOrgRole: string(org.RoleAdmin),
Password: "admin-42",
Login: "admin-42",
@@ -362,8 +362,8 @@ func TestIntegrationAdminConfiguration_CannotCreateInhibitionRules(t *testing.T)
EnableUnifiedAlerting: true,
AppModeProduction: true,
})
grafanaListedAddr, store := testinfra.StartGrafana(t, dir, path)
createUser(t, store, user.CreateUserCommand{
grafanaListedAddr, env := testinfra.StartGrafanaEnv(t, dir, path)
createUser(t, env.SQLStore, env.Cfg, user.CreateUserCommand{
DefaultOrgRole: string(org.RoleAdmin),
Password: "admin",
Login: "admin",