mirror of
https://github.com/postgres/postgres.git
synced 2025-06-17 17:02:08 +03:00
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: Michael Paquier <michael.paquier@gmail.com> Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
This commit is contained in:
@ -39,7 +39,6 @@ our @EXPORT = qw(
|
||||
sub run_test_psql
|
||||
{
|
||||
my $connstr = $_[0];
|
||||
my $logstring = $_[1];
|
||||
|
||||
my $cmd = [
|
||||
'psql', '-X', '-A', '-t', '-c', "SELECT \$\$connected with $connstr\$\$",
|
||||
@ -49,19 +48,15 @@ sub run_test_psql
|
||||
return $result;
|
||||
}
|
||||
|
||||
#
|
||||
# The first argument is a base connection string to use for connection.
|
||||
# The second argument is a complementary connection string, and it's also
|
||||
# printed out as the test case name.
|
||||
# The second argument is a complementary connection string.
|
||||
sub test_connect_ok
|
||||
{
|
||||
my $common_connstr = $_[0];
|
||||
my $connstr = $_[1];
|
||||
my $test_name = $_[2];
|
||||
|
||||
my $result =
|
||||
run_test_psql("$common_connstr $connstr", "(should succeed)");
|
||||
ok($result, $test_name || $connstr);
|
||||
ok(run_test_psql("$common_connstr $connstr"), $test_name);
|
||||
}
|
||||
|
||||
sub test_connect_fails
|
||||
@ -70,8 +65,7 @@ sub test_connect_fails
|
||||
my $connstr = $_[1];
|
||||
my $test_name = $_[2];
|
||||
|
||||
my $result = run_test_psql("$common_connstr $connstr", "(should fail)");
|
||||
ok(!$result, $test_name || "$connstr (should fail)");
|
||||
ok(!run_test_psql("$common_connstr $connstr"), $test_name);
|
||||
}
|
||||
|
||||
# Copy a set of files, taking into account wildcards
|
||||
@ -151,9 +145,6 @@ sub switch_server_cert
|
||||
my $cafile = $_[2] || "root+client_ca";
|
||||
my $pgdata = $node->data_dir;
|
||||
|
||||
note
|
||||
"reloading server with certfile \"$certfile\" and cafile \"$cafile\"";
|
||||
|
||||
open my $sslconf, '>', "$pgdata/sslconfig.conf";
|
||||
print $sslconf "ssl=on\n";
|
||||
print $sslconf "ssl_ca_file='$cafile.crt'\n";
|
||||
|
Reference in New Issue
Block a user