diff options
author | Michael Paquier <michael@paquier.xyz> | 2021-04-01 09:48:17 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2021-04-01 09:48:17 +0900 |
commit | 0d1a33438d3a88938264e12e94c22818307d2f4d (patch) | |
tree | b5f41e9584570ab2750af52c5a6703292a9efe89 /src/test/ssl/t/SSLServer.pm | |
parent | 28b3e3905c982c42fb10ee800e6f881e9742c89d (diff) | |
download | postgresql-0d1a33438d3a88938264e12e94c22818307d2f4d.tar.gz postgresql-0d1a33438d3a88938264e12e94c22818307d2f4d.zip |
Move some client-specific routines from SSLServer to PostgresNode
test_connect_ok() and test_connect_fails() have always been part of the
SSL tests, and check if a connection to the backend should work or not,
and there are sanity checks done on specific error patterns dropped by
libpq if the connection fails.
This was fundamentally wrong on two aspects. First, SSLServer.pm works
mostly on setting up and changing the SSL configuration of a
PostgresNode, and has really nothing to do with the client. Second,
the situation became worse in light of b34ca595, where the SSL tests
would finish by using a psql command that may not come from the same
installation as the node set up.
This commit moves those client routines into PostgresNode, making easier
the refactoring of SSLServer to become more SSL-implementation aware.
This can also be reused by the ldap, kerberos and authentication test
suites for connection checks, and a follow-up patch should extend those
interfaces to match with backend log patterns.
Author: Michael Paquier
Reviewed-by: Andrew Dunstan, Daniel Gustafsson, Álvaro Herrera
Discussion: https://postgr.es/m/YGLKNBf9zyh6+WSt@paquier.xyz
Diffstat (limited to 'src/test/ssl/t/SSLServer.pm')
-rw-r--r-- | src/test/ssl/t/SSLServer.pm | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/test/ssl/t/SSLServer.pm b/src/test/ssl/t/SSLServer.pm index c494c1ad1cb..129a7154a98 100644 --- a/src/test/ssl/t/SSLServer.pm +++ b/src/test/ssl/t/SSLServer.pm @@ -37,46 +37,8 @@ use Exporter 'import'; our @EXPORT = qw( configure_test_server_for_ssl switch_server_cert - test_connect_fails - test_connect_ok ); -# Define a couple of helper functions to test connecting to the server. - -# The first argument is a base connection string to use for connection. -# The second argument is a complementary connection string. -sub test_connect_ok -{ - local $Test::Builder::Level = $Test::Builder::Level + 1; - - my ($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); - return; -} - -sub test_connect_fails -{ - local $Test::Builder::Level = $Test::Builder::Level + 1; - - my ($common_connstr, $connstr, $expected_stderr, $test_name) = @_; - - my $cmd = [ - 'psql', '-X', '-A', '-t', '-c', - "SELECT \$\$connected with $connstr\$\$", - '-d', "$common_connstr $connstr" - ]; - - command_fails_like($cmd, $expected_stderr, $test_name); - return; -} - # Copy a set of files, taking into account wildcards sub copy_files { |