mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +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:
@ -4,9 +4,9 @@
|
||||
|
||||
-- clean-up in case a prior regression run failed
|
||||
SET client_min_messages TO 'warning';
|
||||
DROP DATABASE IF EXISTS regtest_sepgsql_test_database_1;
|
||||
DROP DATABASE IF EXISTS regtest_sepgsql_test_database;
|
||||
DROP USER IF EXISTS regtest_sepgsql_test_user;
|
||||
DROP DATABASE IF EXISTS sepgsql_test_regression_1;
|
||||
DROP DATABASE IF EXISTS sepgsql_test_regression;
|
||||
DROP USER IF EXISTS regress_sepgsql_test_user;
|
||||
RESET client_min_messages;
|
||||
|
||||
-- @SECURITY-CONTEXT=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0
|
||||
@ -14,9 +14,9 @@ RESET client_min_messages;
|
||||
--
|
||||
-- CREATE Objects to be altered (with debug_audit being silent)
|
||||
--
|
||||
CREATE DATABASE regtest_sepgsql_test_database_1;
|
||||
CREATE DATABASE sepgsql_test_regression_1;
|
||||
|
||||
CREATE USER regtest_sepgsql_test_user;
|
||||
CREATE USER regress_sepgsql_test_user;
|
||||
|
||||
CREATE SCHEMA regtest_schema_1;
|
||||
CREATE SCHEMA regtest_schema_2;
|
||||
@ -49,18 +49,18 @@ SET client_min_messages = LOG;
|
||||
-- XXX: It should take db_xxx:{setattr} permission checks even if
|
||||
-- owner is not actually changed.
|
||||
--
|
||||
ALTER DATABASE regtest_sepgsql_test_database_1 OWNER TO regtest_sepgsql_test_user;
|
||||
ALTER DATABASE regtest_sepgsql_test_database_1 OWNER TO regtest_sepgsql_test_user;
|
||||
ALTER SCHEMA regtest_schema_1 OWNER TO regtest_sepgsql_test_user;
|
||||
ALTER SCHEMA regtest_schema_1 OWNER TO regtest_sepgsql_test_user;
|
||||
ALTER TABLE regtest_table_1 OWNER TO regtest_sepgsql_test_user;
|
||||
ALTER TABLE regtest_table_1 OWNER TO regtest_sepgsql_test_user;
|
||||
ALTER SEQUENCE regtest_seq_1 OWNER TO regtest_sepgsql_test_user;
|
||||
ALTER SEQUENCE regtest_seq_1 OWNER TO regtest_sepgsql_test_user;
|
||||
ALTER VIEW regtest_view_1 OWNER TO regtest_sepgsql_test_user;
|
||||
ALTER VIEW regtest_view_1 OWNER TO regtest_sepgsql_test_user;
|
||||
ALTER FUNCTION regtest_func_1(text) OWNER TO regtest_sepgsql_test_user;
|
||||
ALTER FUNCTION regtest_func_1(text) OWNER TO regtest_sepgsql_test_user;
|
||||
ALTER DATABASE sepgsql_test_regression_1 OWNER TO regress_sepgsql_test_user;
|
||||
ALTER DATABASE sepgsql_test_regression_1 OWNER TO regress_sepgsql_test_user;
|
||||
ALTER SCHEMA regtest_schema_1 OWNER TO regress_sepgsql_test_user;
|
||||
ALTER SCHEMA regtest_schema_1 OWNER TO regress_sepgsql_test_user;
|
||||
ALTER TABLE regtest_table_1 OWNER TO regress_sepgsql_test_user;
|
||||
ALTER TABLE regtest_table_1 OWNER TO regress_sepgsql_test_user;
|
||||
ALTER SEQUENCE regtest_seq_1 OWNER TO regress_sepgsql_test_user;
|
||||
ALTER SEQUENCE regtest_seq_1 OWNER TO regress_sepgsql_test_user;
|
||||
ALTER VIEW regtest_view_1 OWNER TO regress_sepgsql_test_user;
|
||||
ALTER VIEW regtest_view_1 OWNER TO regress_sepgsql_test_user;
|
||||
ALTER FUNCTION regtest_func_1(text) OWNER TO regress_sepgsql_test_user;
|
||||
ALTER FUNCTION regtest_func_1(text) OWNER TO regress_sepgsql_test_user;
|
||||
|
||||
--
|
||||
-- ALTER xxx SET SCHEMA
|
||||
@ -73,7 +73,7 @@ ALTER FUNCTION regtest_func_1(text) SET SCHEMA regtest_schema_2;
|
||||
--
|
||||
-- ALTER xxx RENAME TO
|
||||
--
|
||||
ALTER DATABASE regtest_sepgsql_test_database_1 RENAME TO regtest_sepgsql_test_database;
|
||||
ALTER DATABASE sepgsql_test_regression_1 RENAME TO sepgsql_test_regression;
|
||||
ALTER SCHEMA regtest_schema_1 RENAME TO regtest_schema;
|
||||
ALTER TABLE regtest_table_1 RENAME TO regtest_table;
|
||||
ALTER SEQUENCE regtest_seq_1 RENAME TO regtest_seq;
|
||||
@ -85,8 +85,8 @@ SET search_path = regtest_schema, regtest_schema_2, public;
|
||||
--
|
||||
-- misc ALTER commands
|
||||
--
|
||||
ALTER DATABASE regtest_sepgsql_test_database CONNECTION LIMIT 999;
|
||||
ALTER DATABASE regtest_sepgsql_test_database SET search_path TO regtest_schema, public; -- not supported yet
|
||||
ALTER DATABASE sepgsql_test_regression CONNECTION LIMIT 999;
|
||||
ALTER DATABASE sepgsql_test_regression SET search_path TO regtest_schema, public; -- not supported yet
|
||||
|
||||
ALTER TABLE regtest_table ADD COLUMN d float;
|
||||
ALTER TABLE regtest_table DROP COLUMN d;
|
||||
@ -130,7 +130,7 @@ ALTER SEQUENCE regtest_seq INCREMENT BY 10 START WITH 1000;
|
||||
--
|
||||
RESET sepgsql.debug_audit;
|
||||
RESET client_min_messages;
|
||||
DROP DATABASE regtest_sepgsql_test_database;
|
||||
DROP DATABASE sepgsql_test_regression;
|
||||
DROP SCHEMA regtest_schema CASCADE;
|
||||
DROP SCHEMA regtest_schema_2 CASCADE;
|
||||
DROP USER regtest_sepgsql_test_user;
|
||||
DROP USER regress_sepgsql_test_user;
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
-- clean-up in case a prior regression run failed
|
||||
SET client_min_messages TO 'warning';
|
||||
DROP DATABASE IF EXISTS regtest_sepgsql_test_database;
|
||||
DROP USER IF EXISTS regtest_sepgsql_test_user;
|
||||
DROP DATABASE IF EXISTS sepgsql_test_regression;
|
||||
DROP USER IF EXISTS regress_sepgsql_test_user;
|
||||
RESET client_min_messages;
|
||||
|
||||
-- confirm required permissions using audit messages
|
||||
@ -16,13 +16,13 @@ SET client_min_messages = LOG;
|
||||
--
|
||||
-- CREATE Permission checks
|
||||
--
|
||||
CREATE DATABASE regtest_sepgsql_test_database;
|
||||
CREATE DATABASE sepgsql_test_regression;
|
||||
|
||||
CREATE USER regtest_sepgsql_test_user;
|
||||
CREATE USER regress_sepgsql_test_user;
|
||||
|
||||
CREATE SCHEMA regtest_schema;
|
||||
|
||||
GRANT ALL ON SCHEMA regtest_schema TO regtest_sepgsql_test_user;
|
||||
GRANT ALL ON SCHEMA regtest_schema TO regress_sepgsql_test_user;
|
||||
|
||||
SET search_path = regtest_schema, public;
|
||||
|
||||
@ -52,7 +52,7 @@ CREATE AGGREGATE regtest_agg (
|
||||
);
|
||||
|
||||
-- CREATE objects owned by others
|
||||
SET SESSION AUTHORIZATION regtest_sepgsql_test_user;
|
||||
SET SESSION AUTHORIZATION regress_sepgsql_test_user;
|
||||
|
||||
SET search_path = regtest_schema, public;
|
||||
|
||||
@ -92,8 +92,8 @@ ALTER TABLE regtest_table_2 SET WITHOUT OIDS;
|
||||
|
||||
DROP TABLE regtest_table;
|
||||
|
||||
DROP OWNED BY regtest_sepgsql_test_user;
|
||||
DROP OWNED BY regress_sepgsql_test_user;
|
||||
|
||||
DROP DATABASE regtest_sepgsql_test_database;
|
||||
DROP USER regtest_sepgsql_test_user;
|
||||
DROP DATABASE sepgsql_test_regression;
|
||||
DROP USER regress_sepgsql_test_user;
|
||||
DROP SCHEMA IF EXISTS regtest_schema CASCADE;
|
||||
|
Reference in New Issue
Block a user