diff --git a/src/test/java/org/elasticsearch/shield/authc/activedirectory/ActiveDirectorySessionFactoryTests.java b/src/test/java/org/elasticsearch/shield/authc/activedirectory/ActiveDirectorySessionFactoryTests.java index 0b0879ea6d6..cab96e95b6d 100644 --- a/src/test/java/org/elasticsearch/shield/authc/activedirectory/ActiveDirectorySessionFactoryTests.java +++ b/src/test/java/org/elasticsearch/shield/authc/activedirectory/ActiveDirectorySessionFactoryTests.java @@ -84,6 +84,8 @@ public class ActiveDirectorySessionFactoryTests extends ElasticsearchTestCase { ActiveDirectorySessionFactory sessionFactory = new ActiveDirectorySessionFactory(config, clientSSLService); try (LdapSession ldap = sessionFactory.open("ironman", SecuredStringTests.build(PASSWORD))) { + // In certain cases we may have a successful bind, but a search should take longer and cause a timeout + ldap.groups(); fail("The TCP connection should timeout before getting groups back"); } catch (ActiveDirectoryException e) { assertThat(e.getCause().getMessage(), containsString("A client-side timeout was encountered while waiting")); diff --git a/src/test/java/org/elasticsearch/shield/authc/ldap/OpenLdapTests.java b/src/test/java/org/elasticsearch/shield/authc/ldap/OpenLdapTests.java index 1b20315aac0..4373150a005 100644 --- a/src/test/java/org/elasticsearch/shield/authc/ldap/OpenLdapTests.java +++ b/src/test/java/org/elasticsearch/shield/authc/ldap/OpenLdapTests.java @@ -110,7 +110,9 @@ public class OpenLdapTests extends ElasticsearchTestCase { RealmConfig config = new RealmConfig("oldap-test", settings); LdapSessionFactory sessionFactory = new LdapSessionFactory(config, clientSSLService); - try (LdapSession ldap = sessionFactory.open("thor", SecuredStringTests.build(PASSWORD))){ + try (LdapSession ldap = sessionFactory.open("thor", SecuredStringTests.build(PASSWORD))) { + // In certain cases we may have a successful bind, but a search should take longer and cause a timeout + ldap.groups(); fail("The TCP connection should timeout before getting groups back"); } catch (ShieldLdapException e) { assertThat(e.getCause().getMessage(), containsString("A client-side timeout was encountered while waiting"));