Fixes review notes

pull/7461/head
gurkanindibay 2024-02-22 16:08:21 +03:00
parent 1fd5a2b8c9
commit 23d8e16f51
5 changed files with 16 additions and 30 deletions

View File

@ -1,12 +1,12 @@
-- Create a new database
set citus.enable_create_database_propagation to on;
CREATE DATABASE test_db;
CREATE DATABASE role_operations_test_db;
SET citus.superuser TO 'postgres';
-- Connect to the new database
\c test_db
\c role_operations_test_db
-- Test CREATE ROLE with various options
CREATE ROLE test_role1 WITH LOGIN PASSWORD 'password1';
\c test_db - - :worker_1_port
\c role_operations_test_db - - :worker_1_port
CREATE USER "test_role2-needs\!escape"
WITH
SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN REPLICATION BYPASSRLS CONNECTION
@ -30,10 +30,10 @@ $$);
[{"rolname":"test_role1","rolsuper":false,"rolinherit":true,"rolcreaterole":false,"rolcreatedb":false,"rolcanlogin":true,"rolreplication":false,"rolbypassrls":false,"rolconnlimit":-1,"pass_not_empty":true,"date":null},{"rolname":"test_role2-needs\\!escape","rolsuper":true,"rolinherit":true,"rolcreaterole":true,"rolcreatedb":true,"rolcanlogin":true,"rolreplication":true,"rolbypassrls":true,"rolconnlimit":10,"pass_not_empty":null,"date":"2023-01-01"}]
(3 rows)
\c test_db - - :master_port
\c role_operations_test_db - - :master_port
-- Test ALTER ROLE with various options
ALTER ROLE test_role1 WITH PASSWORD 'new_password1';
\c test_db - - :worker_1_port
\c role_operations_test_db - - :worker_1_port
ALTER USER "test_role2-needs\!escape"
WITH
NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT NOLOGIN NOREPLICATION NOBYPASSRLS CONNECTION
@ -57,11 +57,11 @@ $$);
[{"rolname":"test_role1","rolsuper":false,"rolinherit":true,"rolcreaterole":false,"rolcreatedb":false,"rolcanlogin":true,"rolreplication":false,"rolbypassrls":false,"rolconnlimit":-1,"pass_not_empty":true,"date":null},{"rolname":"test_role2-needs\\!escape","rolsuper":false,"rolinherit":false,"rolcreaterole":false,"rolcreatedb":false,"rolcanlogin":false,"rolreplication":false,"rolbypassrls":false,"rolconnlimit":5,"pass_not_empty":null,"date":"2024-01-01"}]
(3 rows)
\c test_db - - :master_port
\c role_operations_test_db - - :master_port
-- Test DROP ROLE
DROP ROLE IF EXISTS test_role1, "test_role2-needs\!escape";
-- Clean up: drop the database
\c regression - - :master_port
set citus.enable_create_database_propagation to on;
DROP DATABASE test_db;
DROP DATABASE role_operations_test_db;
reset citus.enable_create_database_propagation;

View File

@ -372,5 +372,5 @@ ORDER BY 1;
view citus_stat_tenants_local
view pg_dist_shard_placement
view time_partitions
(361 rows)
(362 rows)

View File

@ -108,8 +108,7 @@ test: object_propagation_debug
test: undistribute_table
test: run_command_on_all_nodes
test: background_task_queue_monitor
test: other_databases grant_role_from_non_maindb
test: role_operations_from_non_maindb
test: other_databases grant_role_from_non_maindb role_operations_from_non_maindb
test: citus_internal_access
# Causal clock test

View File

@ -99,8 +99,6 @@ select result FROM run_command_on_all_nodes($$
) t
$$);
--test for alter user
select 1 from citus_remove_node('localhost', :worker_2_port);
\c metadata_sync_2pc_db - - :master_port
@ -154,7 +152,6 @@ $$);
set citus.enable_create_database_propagation to on;
drop database metadata_sync_2pc_db;
drop schema metadata_sync_2pc_schema;
reset citus.enable_create_database_propagation;

View File

@ -1,15 +1,13 @@
-- Create a new database
set citus.enable_create_database_propagation to on;
CREATE DATABASE test_db;
CREATE DATABASE role_operations_test_db;
SET citus.superuser TO 'postgres';
-- Connect to the new database
\c test_db
\c role_operations_test_db
-- Test CREATE ROLE with various options
CREATE ROLE test_role1 WITH LOGIN PASSWORD 'password1';
\c test_db - - :worker_1_port
\c role_operations_test_db - - :worker_1_port
CREATE USER "test_role2-needs\!escape"
WITH
SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN REPLICATION BYPASSRLS CONNECTION
@ -29,20 +27,17 @@ select result FROM run_command_on_all_nodes($$
) t
$$);
\c test_db - - :master_port
\c role_operations_test_db - - :master_port
-- Test ALTER ROLE with various options
ALTER ROLE test_role1 WITH PASSWORD 'new_password1';
\c test_db - - :worker_1_port
\c role_operations_test_db - - :worker_1_port
ALTER USER "test_role2-needs\!escape"
WITH
NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT NOLOGIN NOREPLICATION NOBYPASSRLS CONNECTION
LIMIT 5 VALID UNTIL '2024-01-01';
\c regression - - :master_port
select result FROM run_command_on_all_nodes($$
SELECT array_to_json(array_agg(row_to_json(t)))
FROM (
@ -55,17 +50,12 @@ select result FROM run_command_on_all_nodes($$
) t
$$);
\c test_db - - :master_port
\c role_operations_test_db - - :master_port
-- Test DROP ROLE
DROP ROLE IF EXISTS test_role1, "test_role2-needs\!escape";
-- Clean up: drop the database
\c regression - - :master_port
set citus.enable_create_database_propagation to on;
DROP DATABASE test_db;
DROP DATABASE role_operations_test_db;
reset citus.enable_create_database_propagation;