Skip to content

Commit d2028e9

Browse files
committed
postgres_fdw: Fix tests on some Windows variants
The tests introduced by commit 76563f8 only work when Unix-domain sockets are available. This is optional on Windows, and buildfarm member drongo runs without them. To fix, skip the test if Unix-domain sockets are not enabled.
1 parent bde2fb7 commit d2028e9

File tree

1 file changed

+39
-34
lines changed

1 file changed

+39
-34
lines changed

contrib/postgres_fdw/t/001_auth_scram.pl

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -68,46 +68,51 @@
6868
test_auth($node2, $db2, "t2",
6969
"SCRAM auth directly on foreign server should still succeed");
7070

71-
# Ensure that trust connections fail without superuser opt-in.
72-
unlink($node1->data_dir . '/pg_hba.conf');
73-
unlink($node2->data_dir . '/pg_hba.conf');
71+
SKIP:
72+
{
73+
skip "test requires Unix-domain sockets", 4 if !$use_unix_sockets;
74+
75+
# Ensure that trust connections fail without superuser opt-in.
76+
unlink($node1->data_dir . '/pg_hba.conf');
77+
unlink($node2->data_dir . '/pg_hba.conf');
7478

75-
$node1->append_conf(
76-
'pg_hba.conf', qq{
79+
$node1->append_conf(
80+
'pg_hba.conf', qq{
7781
local db0 all scram-sha-256
7882
local db1 all trust
7983
}
80-
);
81-
$node2->append_conf(
82-
'pg_hba.conf', qq{
84+
);
85+
$node2->append_conf(
86+
'pg_hba.conf', qq{
8387
local all all password
8488
}
85-
);
86-
87-
$node1->restart;
88-
$node2->restart;
89-
90-
my ($ret, $stdout, $stderr) = $node1->psql(
91-
$db0,
92-
qq'select count(1) from t',
93-
connstr => $node1->connstr($db0) . " user=$user");
94-
95-
is($ret, 3, 'loopback trust fails on the same cluster');
96-
like(
97-
$stderr,
98-
qr/failed: authentication method requirement "scram-sha-256"/,
99-
'expected error from loopback trust (same cluster)');
100-
101-
($ret, $stdout, $stderr) = $node1->psql(
102-
$db0,
103-
qq'select count(1) from t2',
104-
connstr => $node1->connstr($db0) . " user=$user");
105-
106-
is($ret, 3, 'loopback password fails on a different cluster');
107-
like(
108-
$stderr,
109-
qr/failed: authentication method requirement "scram-sha-256"/,
110-
'expected error from loopback password (different cluster)');
89+
);
90+
91+
$node1->restart;
92+
$node2->restart;
93+
94+
my ($ret, $stdout, $stderr) = $node1->psql(
95+
$db0,
96+
qq'select count(1) from t',
97+
connstr => $node1->connstr($db0) . " user=$user");
98+
99+
is($ret, 3, 'loopback trust fails on the same cluster');
100+
like(
101+
$stderr,
102+
qr/failed: authentication method requirement "scram-sha-256"/,
103+
'expected error from loopback trust (same cluster)');
104+
105+
($ret, $stdout, $stderr) = $node1->psql(
106+
$db0,
107+
qq'select count(1) from t2',
108+
connstr => $node1->connstr($db0) . " user=$user");
109+
110+
is($ret, 3, 'loopback password fails on a different cluster');
111+
like(
112+
$stderr,
113+
qr/failed: authentication method requirement "scram-sha-256"/,
114+
'expected error from loopback password (different cluster)');
115+
}
111116

112117
# Helper functions
113118

0 commit comments

Comments
 (0)