summaryrefslogtreecommitdiff
path: root/src/test/ldap
diff options
context:
space:
mode:
authorMichael Paquier2021-04-05 01:13:57 +0000
committerMichael Paquier2021-04-05 01:13:57 +0000
commitc50624cdd248c13b4ba199f95e24c88d2cc8a097 (patch)
tree6fb036a55f9ad4f15b63cc64c23127d24759de6c /src/test/ldap
parentdfc843d465689d2c2af8b0e01c66c51ccaae2343 (diff)
Refactor all TAP test suites doing connection checks
This commit refactors more TAP tests to adapt with the recent introduction of connect_ok() and connect_fails() in PostgresNode, introduced by 0d1a3343. This changes the following test suites to use the same code paths for connection checks: - Kerberos - LDAP - SSL - Authentication Those routines are extended to be able to handle optional parameters that are set depending on each suite's needs, as of: - custom SQL query. - expected stderr matching pattern. - expected stdout matching pattern. The new design is extensible with more parameters, and there are some plans for those routines in the future with checks based on the contents of the backend logs. Author: Jacob Champion, Michael Paquier Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/test/ldap')
-rw-r--r--src/test/ldap/t/001_auth.pl17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/test/ldap/t/001_auth.pl b/src/test/ldap/t/001_auth.pl
index 3bc7672451e..ad54854a422 100644
--- a/src/test/ldap/t/001_auth.pl
+++ b/src/test/ldap/t/001_auth.pl
@@ -163,12 +163,17 @@ note "running tests";
sub test_access
{
my ($node, $role, $expected_res, $test_name) = @_;
-
- my $res =
- $node->psql('postgres', undef,
- extra_params => [ '-U', $role, '-c', 'SELECT 1' ]);
- is($res, $expected_res, $test_name);
- return;
+ my $connstr = "user=$role";
+
+ if ($expected_res eq 0)
+ {
+ $node->connect_ok($connstr, $test_name);
+ }
+ else
+ {
+ # No checks of the error message, only the status code.
+ $node->connect_fails($connstr, $test_name);
+ }
}
note "simple bind";