Make compression_bgw executable multiple times

The test compression_bgw cannot be executed multiple times because a
role was created and not properly deleted. This PR adds the needed
teardown step to the test.
This commit is contained in:
Jan Nidzwetzki 2023-09-22 13:51:51 +02:00 committed by Jan Nidzwetzki
parent bdcca067b3
commit 092cb6dfd6
2 changed files with 11 additions and 0 deletions

View File

@ -272,6 +272,7 @@ ALTER TABLE test_table_nologin set (timescaledb.compress);
SELECT add_compression_policy('test_table_nologin', 2::int); SELECT add_compression_policy('test_table_nologin', 2::int);
ERROR: permission denied to start background process as role "nologin_role" ERROR: permission denied to start background process as role "nologin_role"
\set ON_ERROR_STOP 1 \set ON_ERROR_STOP 1
DROP TABLE test_table_nologin;
RESET ROLE; RESET ROLE;
REVOKE NOLOGIN_ROLE FROM :ROLE_DEFAULT_PERM_USER; REVOKE NOLOGIN_ROLE FROM :ROLE_DEFAULT_PERM_USER;
\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER \c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER
@ -651,3 +652,7 @@ SELECT delete_job(:JOB_RECOMPRESS);
(1 row) (1 row)
-- Teardown test
\c :TEST_DBNAME :ROLE_SUPERUSER
REVOKE CREATE ON SCHEMA public FROM NOLOGIN_ROLE;
DROP ROLE NOLOGIN_ROLE;

View File

@ -159,6 +159,7 @@ ALTER TABLE test_table_nologin set (timescaledb.compress);
\set ON_ERROR_STOP 0 \set ON_ERROR_STOP 0
SELECT add_compression_policy('test_table_nologin', 2::int); SELECT add_compression_policy('test_table_nologin', 2::int);
\set ON_ERROR_STOP 1 \set ON_ERROR_STOP 1
DROP TABLE test_table_nologin;
RESET ROLE; RESET ROLE;
REVOKE NOLOGIN_ROLE FROM :ROLE_DEFAULT_PERM_USER; REVOKE NOLOGIN_ROLE FROM :ROLE_DEFAULT_PERM_USER;
@ -217,3 +218,8 @@ SELECT count(*) FROM timescaledb_information.chunks
WHERE hypertable_name = 'conditions' and is_compressed = true; WHERE hypertable_name = 'conditions' and is_compressed = true;
\i include/recompress_basic.sql \i include/recompress_basic.sql
-- Teardown test
\c :TEST_DBNAME :ROLE_SUPERUSER
REVOKE CREATE ON SCHEMA public FROM NOLOGIN_ROLE;
DROP ROLE NOLOGIN_ROLE;