aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2024-09-04 08:56:28 +0900
committerMichael Paquier <michael@paquier.xyz>2024-09-04 08:56:28 +0900
commitbab1fd9277c2b1ef9ef70552d95a6e16c1f3cad4 (patch)
treed323134149777ca86ba0fca6a1e967d5269f7542
parentff43b5e70d45c8d39ca7513e10c23367435c9826 (diff)
downloadpostgresql-bab1fd9277c2b1ef9ef70552d95a6e16c1f3cad4.tar.gz
postgresql-bab1fd9277c2b1ef9ef70552d95a6e16c1f3cad4.zip
Avoid installcheck failure in TAP tests using injection_points
These tests depend on the test module injection_points to be installed, but it may not be available as the contents of src/test/modules/ are not installed by default. This commit adds a workaround based on a scan of pg_available_extensions to check if the extension is available, skipping the test if it is not. This allows installcheck to work transparently. There are more tests impacted by this problem on HEAD, but for now this addresses only the tests that exist on HEAD and v17 as the release is close by. Reported-by: Maxim Orlov Discussion: https://postgr.es/m/CACG=ezZkoT-pFz6a9XnyToiuR-Wg8fGELqHLoyBodr+2h-77qA@mail.gmail.com Backpatch-through: 17
-rw-r--r--src/test/modules/test_misc/t/005_timeouts.pl12
-rw-r--r--src/test/recovery/t/041_checkpoint_at_promote.pl11
2 files changed, 23 insertions, 0 deletions
diff --git a/src/test/modules/test_misc/t/005_timeouts.pl b/src/test/modules/test_misc/t/005_timeouts.pl
index 9e1ff9e5c1c..53e44016e3a 100644
--- a/src/test/modules/test_misc/t/005_timeouts.pl
+++ b/src/test/modules/test_misc/t/005_timeouts.pl
@@ -24,6 +24,18 @@ if ($ENV{enable_injection_points} ne 'yes')
my $node = PostgreSQL::Test::Cluster->new('master');
$node->init();
$node->start;
+
+# Check if the extension injection_points is available, as it may be
+# possible that this script is run with installcheck, where the module
+# would not be installed by default.
+my $result = $node->safe_psql('postgres',
+ "SELECT count(*) > 0 FROM pg_available_extensions WHERE name = 'injection_points';"
+);
+if ($result eq 'f')
+{
+ plan skip_all => 'Extension injection_points not installed';
+}
+
$node->safe_psql('postgres', 'CREATE EXTENSION injection_points;');
#
diff --git a/src/test/recovery/t/041_checkpoint_at_promote.pl b/src/test/recovery/t/041_checkpoint_at_promote.pl
index 5aa05b456ca..905662353da 100644
--- a/src/test/recovery/t/041_checkpoint_at_promote.pl
+++ b/src/test/recovery/t/041_checkpoint_at_promote.pl
@@ -35,6 +35,17 @@ restart_after_crash = on
]);
$node_primary->start;
+# Check if the extension injection_points is available, as it may be
+# possible that this script is run with installcheck, where the module
+# would not be installed by default.
+my $result = $node_primary->safe_psql('postgres',
+ "SELECT count(*) > 0 FROM pg_available_extensions WHERE name = 'injection_points';"
+);
+if ($result eq 'f')
+{
+ plan skip_all => 'Extension injection_points not installed';
+}
+
my $backup_name = 'my_backup';
$node_primary->backup($backup_name);