-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: add a mixed version test for system.role_members user ids upgrade
This patch adds a mixed version logictest that ensures that GRANT ROLE continues to work properly in a cluster with both 22.2 and 23.1 nodes (i.e. nodes that have run the system.role_members user ids upgrade). Release note: None
- Loading branch information
1 parent
a0240e8
commit 2538d07
Showing
3 changed files
with
124 additions
and
1 deletion.
There are no files selected for viewing
116 changes: 116 additions & 0 deletions
116
pkg/sql/logictest/testdata/logic_test/testserver_22.2_23.1_role_members_user_ids_upgrade
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# LogicTest: cockroach-go-testserver-22.2-master | ||
|
||
query T nodeidx=0 | ||
SELECT crdb_internal.node_executable_version() | ||
---- | ||
22.2 | ||
|
||
query T nodeidx=1 | ||
SELECT crdb_internal.node_executable_version() | ||
---- | ||
22.2 | ||
|
||
query T nodeidx=2 | ||
SELECT crdb_internal.node_executable_version() | ||
---- | ||
22.2 | ||
|
||
statement ok | ||
CREATE USER testuser1 | ||
|
||
statement ok | ||
CREATE USER testuser2 | ||
|
||
statement ok | ||
CREATE USER testuser3 | ||
|
||
query TO | ||
SELECT username, user_id FROM system.users | ||
---- | ||
root 1 | ||
admin 2 | ||
testuser 100 | ||
testuser1 101 | ||
testuser2 102 | ||
testuser3 103 | ||
|
||
query TTB | ||
SELECT * FROM system.role_members | ||
---- | ||
admin root true | ||
|
||
statement ok | ||
GRANT testuser1 TO testuser2 | ||
|
||
query TTB | ||
SELECT * FROM system.role_members | ||
---- | ||
admin root true | ||
testuser1 testuser2 false | ||
|
||
upgrade 1 | ||
|
||
query B nodeidx=1 | ||
SELECT crdb_internal.node_executable_version() SIMILAR TO '1000022.2-%' | ||
---- | ||
true | ||
|
||
user root nodeidx=1 | ||
|
||
statement ok | ||
GRANT testuser1 TO testuser3 | ||
|
||
user root nodeidx=0 | ||
|
||
query TTB | ||
SELECT * FROM system.role_members | ||
---- | ||
admin root true | ||
testuser1 testuser2 false | ||
testuser1 testuser3 false | ||
|
||
statement ok | ||
GRANT testuser2 TO testuser3 | ||
|
||
query TTB | ||
SELECT * FROM system.role_members | ||
---- | ||
admin root true | ||
testuser1 testuser2 false | ||
testuser1 testuser3 false | ||
testuser2 testuser3 false | ||
|
||
upgrade 0 | ||
|
||
upgrade 2 | ||
|
||
query B nodeidx=0 | ||
SELECT crdb_internal.node_executable_version() SIMILAR TO '1000022.2-%' | ||
---- | ||
true | ||
|
||
query B nodeidx=1 | ||
SELECT crdb_internal.node_executable_version() SIMILAR TO '1000022.2-%' | ||
---- | ||
true | ||
|
||
query B nodeidx=2 | ||
SELECT crdb_internal.node_executable_version() SIMILAR TO '1000022.2-%' | ||
---- | ||
true | ||
|
||
# Wait for migrations to run. | ||
sleep 10s | ||
|
||
query B retry | ||
SELECT crdb_internal.is_at_least_version('1000022.2-14') | ||
---- | ||
true | ||
|
||
query TTBOO | ||
SELECT * FROM system.role_members | ||
---- | ||
admin root true 2 1 | ||
testuser1 testuser2 false 101 102 | ||
testuser1 testuser3 false 101 103 | ||
testuser2 testuser3 false 102 103 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
pkg/sql/logictest/tests/cockroach-go-testserver-22.2-master/generated_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.