forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 1
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
44d9f3c
commit 7cb807e
Showing
3 changed files
with
137 additions
and
1 deletion.
There are no files selected for viewing
129 changes: 129 additions & 0 deletions
129
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,129 @@ | ||
# LogicTest: cockroach-go-testserver-22.2-master | ||
|
||
# Verify that all nodes are running 22.2 binaries. | ||
|
||
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 | ||
|
||
# Create test users. | ||
|
||
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 | ||
|
||
# Create a role membership that will be checked again later on 23.1. | ||
|
||
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 | ||
|
||
# Test that there are no problems creating role memberships on a mixed 22.2/23.1 cluster. | ||
|
||
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 | ||
|
||
# Verify that all nodes are now running 23.1 binaries. | ||
|
||
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 | ||
|
||
# Verify that ID columns are now present. | ||
|
||
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.