Fix: Ensure SA migrations doesn't hit migrated SAs if rerun (#94347)
* ensure mig doesn't hit migrated SAs if rerun * Fix small issue with the test --------- Co-authored-by: gamab <gabriel.mabille@grafana.com>
This commit is contained in:
@@ -15,6 +15,9 @@ import (
|
||||
)
|
||||
|
||||
func TestIntegrationServiceAccountMigration(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
// Run initial migration to have a working DB
|
||||
x := setupTestDB(t)
|
||||
|
||||
@@ -211,6 +214,43 @@ func TestIntegrationServiceAccountMigration(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "avoid reapply of migration",
|
||||
serviceAccounts: []*user.User{
|
||||
{
|
||||
ID: 11,
|
||||
UID: "u11",
|
||||
Name: "sa-1-extsvc-bug",
|
||||
Login: "sa-1-extsvc-bug",
|
||||
Email: "sa-1-extsvc-bug@org.com",
|
||||
OrgID: 1,
|
||||
Created: now,
|
||||
Updated: now,
|
||||
IsServiceAccount: true,
|
||||
},
|
||||
{
|
||||
ID: 12,
|
||||
UID: "u12",
|
||||
Name: "sa-2-extsvc-bug2",
|
||||
Login: "sa-2-extsvc-bug2",
|
||||
Email: "sa-2-extsvc-bug2@org.com",
|
||||
OrgID: 2,
|
||||
Created: now,
|
||||
Updated: now,
|
||||
IsServiceAccount: true,
|
||||
},
|
||||
},
|
||||
wantServiceAccounts: []*user.User{
|
||||
{
|
||||
ID: 11,
|
||||
Login: "sa-1-extsvc-bug",
|
||||
},
|
||||
{
|
||||
ID: 12,
|
||||
Login: "sa-2-extsvc-bug2",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user