Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5735521

Browse files
committed
Check availability of module injection_points in TAP tests
This fixes defects with installcheck for TAP tests that expect themodule injection_points to exist in an installation, but the contents ofsrc/test/modules are not installed by default with installcheck. Thiswould cause, for example, failures under installcheck-world for a buildwith injection points enabled, when the contents of src/test/modules/are not installed.The availability of the module can be done with a scan ofpg_available_extension. This has been introduced in2cdcae9, andit is refactored here as a new routine in Cluster.pm.Tests are changed in different ways depending on what they need:- The libpq TAP test sets up a node even without injection points, so itis enough to check that CREATE EXTENSION can be used. There is no needfor the variable enable_injection_points.- In test_misc, 006_signal_autovacuum requires a runtime check.- 041_checkpoint_at_promote in recovery tests and 005_timeouts intest_misc are updated to use the routine introduced in Cluster.pm.- test_slru's 001_multixact, injection_points's 001_stats andmodules/gin/ do not require a check as these modules disableinstallcheck entirely.Discussion:https://postgr.es/m/ZtesYQ-WupeAK7xK@paquier.xyz
1 parent908a968 commit5735521

File tree

7 files changed

+39
-12
lines changed

7 files changed

+39
-12
lines changed

‎src/interfaces/libpq/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ subdir = src/interfaces/libpq
1515
top_builddir = ../../..
1616
include$(top_builddir)/src/Makefile.global
1717

18-
exportwith_sslwith_gssapiwith_krb_srvnamenable_injection_points
18+
exportwith_sslwith_gssapiwith_krb_srvnam
1919

2020
PGFILEDESC = "PostgreSQL Access Library"
2121

‎src/interfaces/libpq/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ tests += {
121121
't/005_negotiate_encryption.pl',
122122
],
123123
'env': {
124-
'enable_injection_points':get_option('injection_points') ?'yes' :'no',
125124
'with_ssl': ssl_library,
126125
'with_gssapi': gssapi.found() ?'yes' :'no',
127126
'with_krb_srvnam':'postgres',

‎src/interfaces/libpq/t/005_negotiate_encryption.pl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@
9090
$ENV{PG_TEST_EXTRA} &&$ENV{PG_TEST_EXTRA} =~/\bkerberos\b/;
9191
my$ssl_supported =$ENV{with_ssl}eq'openssl';
9292

93-
my$injection_points_supported =$ENV{enable_injection_points}eq'yes';
94-
9593
###
9694
### Prepare test server for GSSAPI and SSL authentication, with a few
9795
### different test users and helper functions. We don't actually
@@ -151,6 +149,11 @@
151149

152150
$node->start;
153151

152+
# Check if the extension injection_points is available, as it may be
153+
# possible that this script is run with installcheck, where the module
154+
# would not be installed by default.
155+
my$injection_points_supported =$node->check_extension('injection_points');
156+
154157
$node->safe_psql('postgres','CREATE USER localuser;');
155158
$node->safe_psql('postgres','CREATE USER testuser;');
156159
$node->safe_psql('postgres','CREATE USER ssluser;');

‎src/test/modules/test_misc/t/005_timeouts.pl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@
2828
# Check if the extension injection_points is available, as it may be
2929
# possible that this script is run with installcheck, where the module
3030
# would not be installed by default.
31-
my$result =$node->safe_psql('postgres',
32-
"SELECT count(*) > 0 FROM pg_available_extensions WHERE name = 'injection_points';"
33-
);
34-
if ($resulteq'f')
31+
if (!$node->check_extension('injection_points'))
3532
{
3633
planskip_all=>'Extension injection_points not installed';
3734
}

‎src/test/modules/test_misc/t/006_signal_autovacuum.pl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@
2525
# This ensures a quick worker spawn.
2626
$node->append_conf('postgresql.conf','autovacuum_naptime = 1');
2727
$node->start;
28+
29+
# Check if the extension injection_points is available, as it may be
30+
# possible that this script is run with installcheck, where the module
31+
# would not be installed by default.
32+
if (!$node->check_extension('injection_points'))
33+
{
34+
planskip_all=>'Extension injection_points not installed';
35+
}
36+
2837
$node->safe_psql('postgres','CREATE EXTENSION injection_points;');
2938

3039
$node->safe_psql(

‎src/test/perl/PostgreSQL/Test/Cluster.pm

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2837,6 +2837,28 @@ sub lsn
28372837

28382838
=pod
28392839
2840+
=item$node->check_extension(extension_name)
2841+
2842+
Scan pg_available_extensions to check that an extension is available in an
2843+
installation.
2844+
2845+
Returns 1 if the extension is available, 0 otherwise.
2846+
2847+
=cut
2848+
2849+
subcheck_extension
2850+
{
2851+
my ($self,$extension_name) =@_;
2852+
2853+
my$result =$self->safe_psql('postgres',
2854+
"SELECT count(*) > 0 FROM pg_available_extensions WHERE name = '$extension_name';"
2855+
);
2856+
2857+
return$resulteq't' ? 1 : 0;
2858+
}
2859+
2860+
=pod
2861+
28402862
=item$node->wait_for_event(wait_event_name, backend_type)
28412863
28422864
Poll pg_stat_activity until backend_type reaches wait_event_name.

‎src/test/recovery/t/041_checkpoint_at_promote.pl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@
3838
# Check if the extension injection_points is available, as it may be
3939
# possible that this script is run with installcheck, where the module
4040
# would not be installed by default.
41-
my$result =$node_primary->safe_psql('postgres',
42-
"SELECT count(*) > 0 FROM pg_available_extensions WHERE name = 'injection_points';"
43-
);
44-
if ($resulteq'f')
41+
if (!$node_primary->check_extension('injection_points'))
4542
{
4643
planskip_all=>'Extension injection_points not installed';
4744
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp