summaryrefslogtreecommitdiff
path: root/src/test/ssl/ServerSetup.pm
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ssl/ServerSetup.pm')
-rw-r--r--src/test/ssl/ServerSetup.pm42
1 files changed, 16 insertions, 26 deletions
diff --git a/src/test/ssl/ServerSetup.pm b/src/test/ssl/ServerSetup.pm
index 45991d61a2a..27a676b65c2 100644
--- a/src/test/ssl/ServerSetup.pm
+++ b/src/test/ssl/ServerSetup.pm
@@ -27,7 +27,6 @@ use Test::More;
use Exporter 'import';
our @EXPORT = qw(
configure_test_server_for_ssl
- run_test_psql
switch_server_cert
test_connect_fails
test_connect_ok
@@ -35,37 +34,28 @@ our @EXPORT = qw(
# Define a couple of helper functions to test connecting to the server.
-# Attempt connection to server with given connection string.
-sub run_test_psql
-{
- my $connstr = $_[0];
-
- my $cmd = [
- 'psql', '-X', '-A', '-t', '-c', "SELECT \$\$connected with $connstr\$\$",
- '-d', "$connstr" ];
-
- my $result = run_log($cmd);
- return $result;
-}
-
# The first argument is a base connection string to use for connection.
# The second argument is a complementary connection string.
sub test_connect_ok
{
- my $common_connstr = $_[0];
- my $connstr = $_[1];
- my $test_name = $_[2];
+ my ($common_connstr, $connstr, $test_name) = @_;
- ok(run_test_psql("$common_connstr $connstr"), $test_name);
+ my $cmd = [
+ 'psql', '-X', '-A', '-t', '-c', "SELECT \$\$connected with $connstr\$\$",
+ '-d', "$common_connstr $connstr" ];
+
+ command_ok($cmd, $test_name);
}
sub test_connect_fails
{
- my $common_connstr = $_[0];
- my $connstr = $_[1];
- my $test_name = $_[2];
+ my ($common_connstr, $connstr, $expected_stderr, $test_name) = @_;
+
+ my $cmd = [
+ 'psql', '-X', '-A', '-t', '-c', "SELECT \$\$connected with $connstr\$\$",
+ '-d', "$common_connstr $connstr" ];
- ok(!run_test_psql("$common_connstr $connstr"), $test_name);
+ command_fails_like($cmd, $expected_stderr, $test_name);
}
# Copy a set of files, taking into account wildcards
@@ -169,12 +159,12 @@ sub configure_hba_for_ssl
print $hba
"# TYPE DATABASE USER ADDRESS METHOD\n";
print $hba
-"hostssl trustdb ssltestuser $serverhost/32 $authmethod\n";
+"hostssl trustdb all $serverhost/32 $authmethod\n";
print $hba
-"hostssl trustdb ssltestuser ::1/128 $authmethod\n";
+"hostssl trustdb all ::1/128 $authmethod\n";
print $hba
-"hostssl certdb ssltestuser $serverhost/32 cert\n";
+"hostssl certdb all $serverhost/32 cert\n";
print $hba
-"hostssl certdb ssltestuser ::1/128 cert\n";
+"hostssl certdb all ::1/128 cert\n";
close $hba;
}