Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a6434b9

Browse files
committed
Fix two portability issues with the tests of test_oat_hooks
This addresses two issues in the tests of test_oat_hooks: - The role regress_test_user was being left behind, preventing the test to succeed on repeated runs. It makes sense to leave some objects behind to have more coverage for pg_upgrade (as does test_pg_dump), but the role dropped here does not own any objects so there is no reason to keep it. - GRANT SET ON PARAMETER is issued, creating an entry in pg_parameter_acl without cleaning up the entry created. This causes an overlap with unsafe_tests as both use work_mem, making the latter fail. This commit adds an extra REVOKE SET ON PARAMETER to clean the contents of pg_parameter_acl, switching to maintenance_work_mem rather than work_mem to avoid an overlap between both tests. The tests of test_oat_hooks cannot use installcheck yet as these are proving to be unstable with caching and the namespace search hooks, so the issues fixed here cannot be reached yet, but they would be once the hook issue is addressed and installcheck is allowed again in test_oat_hooks. Discussion: https://postgr.es/m/YrpVkADAY0knF6vM@paquier.xyz Backpatch-through: 15
1 parent 0a6be1f commit a6434b9

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/test/modules/test_oat_hooks/expected/test_oat_hooks.out

+6-2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@ privileges for parameter test_oat_hooks.super_var2
4141
privileges for parameter none.such
4242
privileges for parameter another.bogus
4343
-- Check the behavior of the hooks relative to do-nothing grants and revokes
44-
GRANT SET ON PARAMETER work_mem TO PUBLIC;
44+
GRANT SET ON PARAMETER maintenance_work_mem TO PUBLIC;
4545
NOTICE: in process utility: superuser attempting GrantStmt
4646
NOTICE: in process utility: superuser finished GrantStmt
47-
REVOKE ALTER SYSTEM ON PARAMETER work_mem FROM PUBLIC;
47+
REVOKE SET ON PARAMETER maintenance_work_mem FROM PUBLIC;
48+
NOTICE: in process utility: superuser attempting GrantStmt
49+
NOTICE: in process utility: superuser finished GrantStmt
50+
REVOKE ALTER SYSTEM ON PARAMETER maintenance_work_mem FROM PUBLIC;
4851
NOTICE: in process utility: superuser attempting GrantStmt
4952
NOTICE: in process utility: superuser finished GrantStmt
5053
-- Check the behavior of the hooks relative to unrecognized parameters
@@ -299,3 +302,4 @@ REVOKE ALL PRIVILEGES ON PARAMETER
299302
test_oat_hooks.user_var2, test_oat_hooks.super_var2
300303
FROM regress_role_joe;
301304
DROP ROLE regress_role_joe;
305+
DROP ROLE regress_test_user;

src/test/modules/test_oat_hooks/sql/test_oat_hooks.sql

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ GRANT SET, ALTER SYSTEM ON PARAMETER another.bogus TO regress_role_joe WITH GRAN
2525
DROP ROLE regress_role_joe;
2626

2727
-- Check the behavior of the hooks relative to do-nothing grants and revokes
28-
GRANT SET ON PARAMETER work_mem TO PUBLIC;
29-
REVOKE ALTER SYSTEM ON PARAMETER work_mem FROM PUBLIC;
28+
GRANT SET ON PARAMETER maintenance_work_mem TO PUBLIC;
29+
REVOKE SET ON PARAMETER maintenance_work_mem FROM PUBLIC;
30+
REVOKE ALTER SYSTEM ON PARAMETER maintenance_work_mem FROM PUBLIC;
3031

3132
-- Check the behavior of the hooks relative to unrecognized parameters
3233
GRANT ALL ON PARAMETER "none.such" TO PUBLIC;
@@ -98,3 +99,4 @@ REVOKE ALL PRIVILEGES ON PARAMETER
9899
test_oat_hooks.user_var2, test_oat_hooks.super_var2
99100
FROM regress_role_joe;
100101
DROP ROLE regress_role_joe;
102+
DROP ROLE regress_test_user;

0 commit comments

Comments
 (0)