Commit b3a101ef authored by Peter Eisentraut's avatar Peter Eisentraut

Refine SSL tests test name reporting

Instead of using the psql/libpq connection string as the displayed test
name and relying on "notes" and source code comments to explain the
tests, give the tests self-explanatory names, like we do elsewhere.
Reviewed-by: default avatarMichael Paquier <michael.paquier@gmail.com>
Reviewed-by: default avatarDaniel Gustafsson <daniel@yesql.se>
parent 882ea509
...@@ -39,7 +39,6 @@ our @EXPORT = qw( ...@@ -39,7 +39,6 @@ our @EXPORT = qw(
sub run_test_psql sub run_test_psql
{ {
my $connstr = $_[0]; my $connstr = $_[0];
my $logstring = $_[1];
my $cmd = [ my $cmd = [
'psql', '-X', '-A', '-t', '-c', "SELECT \$\$connected with $connstr\$\$", 'psql', '-X', '-A', '-t', '-c', "SELECT \$\$connected with $connstr\$\$",
...@@ -49,19 +48,15 @@ sub run_test_psql ...@@ -49,19 +48,15 @@ sub run_test_psql
return $result; return $result;
} }
#
# The first argument is a base connection string to use for connection. # The first argument is a base connection string to use for connection.
# The second argument is a complementary connection string, and it's also # The second argument is a complementary connection string.
# printed out as the test case name.
sub test_connect_ok sub test_connect_ok
{ {
my $common_connstr = $_[0]; my $common_connstr = $_[0];
my $connstr = $_[1]; my $connstr = $_[1];
my $test_name = $_[2]; my $test_name = $_[2];
my $result = ok(run_test_psql("$common_connstr $connstr"), $test_name);
run_test_psql("$common_connstr $connstr", "(should succeed)");
ok($result, $test_name || $connstr);
} }
sub test_connect_fails sub test_connect_fails
...@@ -70,8 +65,7 @@ sub test_connect_fails ...@@ -70,8 +65,7 @@ sub test_connect_fails
my $connstr = $_[1]; my $connstr = $_[1];
my $test_name = $_[2]; my $test_name = $_[2];
my $result = run_test_psql("$common_connstr $connstr", "(should fail)"); ok(!run_test_psql("$common_connstr $connstr"), $test_name);
ok(!$result, $test_name || "$connstr (should fail)");
} }
# Copy a set of files, taking into account wildcards # Copy a set of files, taking into account wildcards
...@@ -151,9 +145,6 @@ sub switch_server_cert ...@@ -151,9 +145,6 @@ sub switch_server_cert
my $cafile = $_[2] || "root+client_ca"; my $cafile = $_[2] || "root+client_ca";
my $pgdata = $node->data_dir; my $pgdata = $node->data_dir;
note
"reloading server with certfile \"$certfile\" and cafile \"$cafile\"";
open my $sslconf, '>', "$pgdata/sslconfig.conf"; open my $sslconf, '>', "$pgdata/sslconfig.conf";
print $sslconf "ssl=on\n"; print $sslconf "ssl=on\n";
print $sslconf "ssl_ca_file='$cafile.crt'\n"; print $sslconf "ssl_ca_file='$cafile.crt'\n";
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment