mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Establish conventions about global object names used in regression tests.
To ensure that "make installcheck" can be used safely against an existing installation, we need to be careful about what global object names (database, role, and tablespace names) we use; otherwise we might accidentally clobber important objects. There's been a weak consensus that test databases should have names including "regression", and that test role names should start with "regress_", but we didn't have any particular rule about tablespace names; and neither of the other rules was followed with any consistency either. This commit moves us a long way towards having a hard-and-fast rule that regression test databases must have names including "regression", and that test role and tablespace names must start with "regress_". It's not completely there because I did not touch some test cases in rolenames.sql that test creation of special role names like "session_user". That will require some rethinking of exactly what we want to test, whereas the intent of this patch is just to hit all the cases in which the needed renamings are cosmetic. There is no enforcement mechanism in this patch either, but if we don't add one we can expect that the tests will soon be violating the convention again. Again, that's not such a cosmetic change and it will require discussion. (But I did use a quick-hack enforcement patch to find these cases.) Discussion: <16638.1468620817@sss.pgh.pa.us>
This commit is contained in:
@ -14,21 +14,21 @@ $node->init;
|
||||
$node->start;
|
||||
|
||||
$node->issues_sql_like(
|
||||
[ 'createuser', 'user1' ],
|
||||
qr/statement: CREATE ROLE user1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;/,
|
||||
[ 'createuser', 'regress_user1' ],
|
||||
qr/statement: CREATE ROLE regress_user1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;/,
|
||||
'SQL CREATE USER run');
|
||||
$node->issues_sql_like(
|
||||
[ 'createuser', '-L', 'role1' ],
|
||||
qr/statement: CREATE ROLE role1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT NOLOGIN;/,
|
||||
[ 'createuser', '-L', 'regress_role1' ],
|
||||
qr/statement: CREATE ROLE regress_role1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT NOLOGIN;/,
|
||||
'create a non-login role');
|
||||
$node->issues_sql_like(
|
||||
[ 'createuser', '-r', 'user2' ],
|
||||
qr/statement: CREATE ROLE user2 NOSUPERUSER NOCREATEDB CREATEROLE INHERIT LOGIN;/,
|
||||
[ 'createuser', '-r', 'regress_user2' ],
|
||||
qr/statement: CREATE ROLE regress_user2 NOSUPERUSER NOCREATEDB CREATEROLE INHERIT LOGIN;/,
|
||||
'create a CREATEROLE user');
|
||||
$node->issues_sql_like(
|
||||
[ 'createuser', '-s', 'user3' ],
|
||||
qr/statement: CREATE ROLE user3 SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;/,
|
||||
[ 'createuser', '-s', 'regress_user3' ],
|
||||
qr/statement: CREATE ROLE regress_user3 SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;/,
|
||||
'create a superuser');
|
||||
|
||||
$node->command_fails([ 'createuser', 'user1' ],
|
||||
$node->command_fails([ 'createuser', 'regress_user1' ],
|
||||
'fails if role already exists');
|
||||
|
Reference in New Issue
Block a user