Skip to content

Commit 56063db

Browse files
[Test] Increase LDAP connection timeout (#87208) (#88119)
Increased LDAP connection timeout to 10s to avoid test failures. By default, LDAP and Active Directory's timeout was set to 5s. This seems not to be enough when running integration tests on CI servers that use Samba fixture. Closes #86958
1 parent 3b6c150 commit 56063db

File tree

1 file changed

+8
-3
lines changed
  • x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/ldap

1 file changed

+8
-3
lines changed

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/ldap/LdapTestUtils.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,21 @@
1515
import org.elasticsearch.common.settings.Settings;
1616
import org.elasticsearch.common.ssl.SslConfiguration;
1717
import org.elasticsearch.common.ssl.SslVerificationMode;
18+
import org.elasticsearch.core.TimeValue;
1819
import org.elasticsearch.env.Environment;
1920
import org.elasticsearch.env.TestEnvironment;
20-
import org.elasticsearch.xpack.core.security.authc.ldap.support.SessionFactorySettings;
2121
import org.elasticsearch.xpack.core.ssl.SSLService;
2222
import org.elasticsearch.xpack.security.authc.ldap.support.LdapUtils;
2323

2424
import java.nio.file.Path;
2525

2626
public class LdapTestUtils {
2727

28+
/**
29+
* Timeout is set to 10 seconds in order to avoid timeouts of some test cases that use the Samba fixture.
30+
*/
31+
private static final TimeValue DEFAULT_LDAP_TIMEOUT = TimeValue.timeValueSeconds(10);
32+
2833
private LdapTestUtils() {
2934
// Utility class
3035
}
@@ -48,8 +53,8 @@ public static LDAPConnection openConnection(String url, String bindDN, String bi
4853
LDAPConnectionOptions options = new LDAPConnectionOptions();
4954
options.setFollowReferrals(true);
5055
options.setAllowConcurrentSocketFactoryUse(true);
51-
options.setConnectTimeoutMillis(Math.toIntExact(SessionFactorySettings.TIMEOUT_DEFAULT.millis()));
52-
options.setResponseTimeoutMillis(SessionFactorySettings.TIMEOUT_DEFAULT.millis());
56+
options.setConnectTimeoutMillis(Math.toIntExact(DEFAULT_LDAP_TIMEOUT.millis()));
57+
options.setResponseTimeoutMillis(DEFAULT_LDAP_TIMEOUT.millis());
5358

5459
final SslConfiguration sslConfiguration = sslService.getSSLConfiguration("xpack.security.authc.realms.ldap.foo.ssl");
5560
return LdapUtils.privilegedConnect(

0 commit comments

Comments
 (0)