Skip to content

Commit 27cd521

Browse files
committed
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
1 parent f63d9e6 commit 27cd521

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/test/ldap/t/001_auth.pl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,22 @@ END
120120
append_to_file($ldap_pwfile, $ldap_rootpw);
121121
chmod 0600, $ldap_pwfile or die;
122122

123+
# wait until slapd accepts requests
124+
my $retries = 0;
125+
while (1)
126+
{
127+
last
128+
if (
129+
system_log(
130+
"ldapsearch", "-h", $ldap_server, "-p",
131+
$ldap_port, "-s", "base", "-b",
132+
$ldap_basedn, "-D", $ldap_rootdn, "-y",
133+
$ldap_pwfile, "-n", "'objectclass=*'") == 0);
134+
die "cannot connect to slapd" if ++$retries >= 300;
135+
note "waiting for slapd to accept requests...";
136+
Time::HiRes::usleep(1000000);
137+
}
138+
123139
$ENV{'LDAPURI'} = $ldap_url;
124140
$ENV{'LDAPBINDDN'} = $ldap_rootdn;
125141
$ENV{'LDAPCONF'} = $ldap_conf;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy