Skip to content

Commit d862ba5

Browse files
claudeNikolayS
authored andcommitted
fix: skip TLE uninstall tests on extension install
In the pg_tle CI job, pgque is installed as an extension. Running sql/pgque-tle-uninstall.sql from test_uninstall_guard.sql there (correctly, after the C4/C9 fixes) drops the extension -- and the whole pgque schema with it -- mid-suite, so the "plain install must survive" assertion failed. Gate the sub-tests that execute the TLE uninstall script behind a psql \if on pgque not being an extension member, emitting the suite's usual SKIP notice; the extension path of the script is covered by tests/test_tle_install.sql. https://claude.ai/code/session_01KAaEGkQZmey1D1xCsVGmqv
1 parent 884ad32 commit d862ba5

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

tests/test_uninstall_guard.sql

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
--
99
-- These tests swap pgque.stop() for instrumented fakes; the real definition
1010
-- is saved first and restored at the end, so the rest of the suite is
11-
-- unaffected. Runs without pg_cron / pg_tle.
11+
-- unaffected. Runs without pg_cron / pg_tle. The TLE uninstall sub-tests
12+
-- only run against a plain (non-extension) install; see the gate below.
1213
--
1314
-- Run from the repo root: the \i commands below resolve relative to cwd.
1415

@@ -36,6 +37,21 @@ begin
3637
raise notice 'PASS: pgque_uninstall.sql aborts before drop when stop() fails';
3738
end $$;
3839

40+
-- Tests 2 and 3 execute sql/pgque-tle-uninstall.sql, which (correctly)
41+
-- drops the pgque extension -- taking the whole schema with it -- and
42+
-- unregisters pgque from pg_tle. Against an extension install (the pg_tle
43+
-- CI job) that would destroy the install mid-suite, so the script must not
44+
-- run at all there: skip both sub-tests. The extension path of the script
45+
-- is covered by tests/test_tle_install.sql.
46+
select exists (select 1 from pg_catalog.pg_extension where extname = 'pgque') as pgque_is_extension
47+
\gset
48+
49+
\if :pgque_is_extension
50+
51+
\echo 'SKIP: pgque is installed as an extension; TLE uninstall sub-tests need a plain install'
52+
53+
\else
54+
3955
-- Test 2 (C4): sql/pgque-tle-uninstall.sql must call pgque.stop() before
4056
-- drop extension, so pg_cron / pg_timetable jobs do not outlive the schema.
4157
create table pg_temp.tle_stop_called (called bool);
@@ -78,6 +94,10 @@ begin
7894
raise notice 'PASS: pgque-tle-uninstall.sql aborts before drop when stop() fails';
7995
end $$;
8096

97+
drop table pg_temp.tle_stop_called;
98+
99+
\endif
100+
81101
-- Restore the real pgque.stop() and verify the restoration.
82102
do $$
83103
declare
@@ -91,4 +111,3 @@ begin
91111
end $$;
92112

93113
drop table pg_temp.saved_stop;
94-
drop table pg_temp.tle_stop_called;

0 commit comments

Comments
 (0)