mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-06 22:49:21 +02:00
Fix LDAP test instability.
After starting slapd, wait until it can accept a connection before beginning the real test work. This avoids occasional test failures. Back-patch to 11, where the LDAP tests arrived. Author: Thomas Munro Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/20190719033013.GI1859%40paquier.xyz
This commit is contained in:
parent
c4944a93eb
commit
3964d3bce9
@ -120,6 +120,22 @@ END
|
|||||||
append_to_file($ldap_pwfile, $ldap_rootpw);
|
append_to_file($ldap_pwfile, $ldap_rootpw);
|
||||||
chmod 0600, $ldap_pwfile or die;
|
chmod 0600, $ldap_pwfile or die;
|
||||||
|
|
||||||
|
# wait until slapd accepts requests
|
||||||
|
my $retries = 0;
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
last
|
||||||
|
if (
|
||||||
|
system_log(
|
||||||
|
"ldapsearch", "-h", $ldap_server, "-p",
|
||||||
|
$ldap_port, "-s", "base", "-b",
|
||||||
|
$ldap_basedn, "-D", $ldap_rootdn, "-y",
|
||||||
|
$ldap_pwfile, "-n", "'objectclass=*'") == 0);
|
||||||
|
die "cannot connect to slapd" if ++$retries >= 300;
|
||||||
|
note "waiting for slapd to accept requests...";
|
||||||
|
Time::HiRes::usleep(1000000);
|
||||||
|
}
|
||||||
|
|
||||||
$ENV{'LDAPURI'} = $ldap_url;
|
$ENV{'LDAPURI'} = $ldap_url;
|
||||||
$ENV{'LDAPBINDDN'} = $ldap_rootdn;
|
$ENV{'LDAPBINDDN'} = $ldap_rootdn;
|
||||||
$ENV{'LDAPCONF'} = $ldap_conf;
|
$ENV{'LDAPCONF'} = $ldap_conf;
|
||||||
|
Loading…
Reference in New Issue
Block a user