Chore: Ensure we save correct default admin user in integration test DB setup (#105752)

* fix helper + amend tests

* fix import + remove unused var

* remove more users

* remove unused code

* update test comment
This commit is contained in:
Will Browne
2025-05-28 11:25:01 +01:00
committed by GitHub
parent 10f2b76156
commit edb0865caa
31 changed files with 95 additions and 501 deletions
@@ -47,11 +47,6 @@ func TestIntegrationAMConfigAccess(t *testing.T) {
Password: "editor",
Login: "editor",
})
createUser(t, env.SQLStore, env.Cfg, user.CreateUserCommand{
DefaultOrgRole: string(org.RoleAdmin),
Password: "admin",
Login: "admin",
})
type testCase struct {
desc string
@@ -365,12 +360,8 @@ func TestIntegrationAlertmanagerCreateSilence(t *testing.T) {
EnableUnifiedAlerting: true,
AppModeProduction: true,
})
grafanaListedAddr, env := testinfra.StartGrafanaEnv(t, dir, path)
createUser(t, env.SQLStore, env.Cfg, user.CreateUserCommand{
DefaultOrgRole: string(org.RoleAdmin),
Password: "admin",
Login: "admin",
})
grafanaListedAddr, _ := testinfra.StartGrafanaEnv(t, dir, path)
client := newAlertingApiClient(grafanaListedAddr, "admin", "admin")
cases := []struct {
@@ -524,7 +515,7 @@ func TestIntegrationAlertmanagerStatus(t *testing.T) {
})
grafanaListedAddr, env := testinfra.StartGrafanaEnv(t, dir, path)
// Create a users to make authenticated requests
// Create users to make authenticated requests
createUser(t, env.SQLStore, env.Cfg, user.CreateUserCommand{
DefaultOrgRole: string(org.RoleViewer),
Password: "viewer",
@@ -535,11 +526,6 @@ func TestIntegrationAlertmanagerStatus(t *testing.T) {
Password: "editor",
Login: "editor",
})
createUser(t, env.SQLStore, env.Cfg, user.CreateUserCommand{
DefaultOrgRole: string(org.RoleAdmin),
Password: "admin",
Login: "admin",
})
type testCase struct {
desc string