Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-24.1: streamingccl: deflake TestBackupRestoreSystemUsers #124063

Merged
merged 1 commit into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions pkg/ccl/backupccl/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9992,19 +9992,19 @@ func TestBackupRestoreSystemUsers(t *testing.T) {

// Role 'app_role' and user 'app' will be added, and 'app' is granted with 'app_role'
// User test will remain untouched with no role granted
sqlDBRestore.CheckQueryResults(t, "SELECT * FROM system.users", [][]string{
{"admin", "", "true", "2"},
{"app", "NULL", "false", "101"},
{"app_role", "NULL", "true", "102"},
{"root", "", "false", "1"},
{"test", "NULL", "false", "100"},
{"test_role", "NULL", "true", "103"},
sqlDBRestore.CheckQueryResults(t, `SELECT username, "isRole" FROM system.users`, [][]string{
{"admin", "true"},
{"app", "false"},
{"app_role", "true"},
{"root", "false"},
{"test", "false"},
{"test_role", "true"},
})
sqlDBRestore.CheckQueryResults(t, "SELECT * FROM system.role_members", [][]string{
{"admin", "app", "false", "2", "101"},
{"admin", "root", "true", "2", "1"},
{"app_role", "app", "false", "102", "101"},
{"app_role", "test_role", "false", "102", "103"},
sqlDBRestore.CheckQueryResults(t, `SELECT "role", member, "isAdmin" FROM system.role_members`, [][]string{
{"admin", "app", "false"},
{"admin", "root", "true"},
{"app_role", "app", "false"},
{"app_role", "test_role", "false"},
})
sqlDBRestore.CheckQueryResults(t, "SHOW USERS", [][]string{
{"admin", "", "{}"},
Expand All @@ -10025,16 +10025,16 @@ func TestBackupRestoreSystemUsers(t *testing.T) {
defer cleanupEmptyCluster1()
t.Run("restore-from-backup-with-no-system-role-members", func(t *testing.T) {
sqlDBRestore1.Exec(t, "RESTORE SYSTEM USERS FROM $1", localFoo+"/3")
sqlDBRestore1.CheckQueryResults(t, "SELECT * FROM system.role_members", [][]string{
{"admin", "root", "true", "2", "1"},
sqlDBRestore1.CheckQueryResults(t, `SELECT "role", member, "isAdmin" FROM system.role_members`, [][]string{
{"admin", "root", "true"},
})
sqlDBRestore1.CheckQueryResults(t, "SELECT * FROM system.users", [][]string{
{"admin", "", "true", "2"},
{"app", "NULL", "false", "100"},
{"app_role", "NULL", "true", "101"},
{"root", "", "false", "1"},
{"test", "NULL", "false", "102"},
{"test_role", "NULL", "true", "103"},
sqlDBRestore1.CheckQueryResults(t, `SELECT username, "isRole" FROM system.users`, [][]string{
{"admin", "true"},
{"app", "false"},
{"app_role", "true"},
{"root", "false"},
{"test", "false"},
{"test_role", "true"},
})
sqlDBRestore1.CheckQueryResults(t, "SHOW USERS", [][]string{
{"admin", "", "{}"},
Expand All @@ -10052,17 +10052,17 @@ func TestBackupRestoreSystemUsers(t *testing.T) {
// allocated properly in the restore.
sqlDBRestore2.Exec(t, "CREATE USER testuser")
sqlDBRestore2.Exec(t, "RESTORE SYSTEM USERS FROM $1", localFoo+"/3")
sqlDBRestore2.CheckQueryResults(t, "SELECT * FROM system.role_members", [][]string{
{"admin", "root", "true", "2", "1"},
sqlDBRestore2.CheckQueryResults(t, `SELECT role, member, "isAdmin" FROM system.role_members`, [][]string{
{"admin", "root", "true"},
})
sqlDBRestore2.CheckQueryResults(t, "SELECT * FROM system.users", [][]string{
{"admin", "", "true", "2"},
{"app", "NULL", "false", "101"},
{"app_role", "NULL", "true", "102"},
{"root", "", "false", "1"},
{"test", "NULL", "false", "103"},
{"test_role", "NULL", "true", "104"},
{"testuser", "NULL", "false", "100"},
sqlDBRestore2.CheckQueryResults(t, `SELECT username, "isRole" FROM system.users`, [][]string{
{"admin", "true"},
{"app", "false"},
{"app_role", "true"},
{"root", "false"},
{"test", "false"},
{"test_role", "true"},
{"testuser", "false"},
})
sqlDBRestore2.CheckQueryResults(t, "SHOW USERS", [][]string{
{"admin", "", "{}"},
Expand Down