Skip to content

Commit df286a5

Browse files
committed
libpq: Add TAP test for nested service file
This test corresponds to the case of a "service" defined in a service file, that libpq is not able to support in parseServiceFile(). This has come up during the review of a patch to add more features in this area, useful on its own. Piece extracted from a larger patch by the same author. Author: Ryo Kanbayashi <kanbayashi.dev@gmail.com> Discussion: https://postgr.es/m/Zz2AE7NKKLIZTtEh@paquier.xyz
1 parent 24f6086 commit df286a5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/interfaces/libpq/t/006_service.pl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@
4747
# Missing service file.
4848
my $srvfile_missing = "$td/pg_service_missing.conf";
4949

50+
# Service file with nested "service" defined.
51+
my $srvfile_nested = "$td/pg_service_nested.conf";
52+
copy($srvfile_valid, $srvfile_nested)
53+
or die "Could not copy $srvfile_valid to $srvfile_nested: $!";
54+
append_to_file($srvfile_nested, 'service=invalid_srv' . $newline);
55+
5056
# Set the fallback directory lookup of the service file to the temporary
5157
# directory of this test. PGSYSCONFDIR is used if the service file
5258
# defined in PGSERVICEFILE cannot be found, or when a service file is
@@ -146,6 +152,17 @@
146152
unlink($srvfile_default);
147153
}
148154

155+
# Checks nested service file contents.
156+
{
157+
local $ENV{PGSERVICEFILE} = $srvfile_nested;
158+
159+
$dummy_node->connect_fails(
160+
'service=my_srv',
161+
'connection with nested service file',
162+
expected_stderr =>
163+
qr/nested service specifications not supported in service file/);
164+
}
165+
149166
$node->teardown_node;
150167

151168
done_testing();

0 commit comments

Comments
 (0)