Skip to content

Commit 65ec033

Browse files
authored
Merge pull request #8174 from kristip17/UpdateContextManagerTest
Issue 8173: Update timeout on ContextManagerTest
2 parents 5aae91a + e7fc361 commit 65ec033

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

dev/com.ibm.ws.security.wim.adapter.ldap/test/com/ibm/ws/security/wim/adapter/ldap/context/ContextManagerTest.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2018 IBM Corporation and others.
2+
* Copyright (c) 2018, 2019 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -730,9 +730,11 @@ public void connectTimeout() throws Exception {
730730

731731
try {
732732
/*
733-
* Configure the context manager with a 100 ms connect timeout.
733+
* Configure the context manager with a 500 ms connect timeout.
734+
* Bumped up from a 100ms timeout as that's probably too much precision to expect from our build machines
735+
* Looking for a balance of testing the timeout without making the unit test take a long time
734736
*/
735-
long expectedTimeout = 100L;
737+
long expectedTimeout = 500L;
736738
ContextManager cm = new ContextManager();
737739
cm.setPrimaryServer("localhost", serverSocket.getLocalPort());
738740
cm.setContextPool(false, null, null, null, null, null);
@@ -744,16 +746,16 @@ public void connectTimeout() throws Exception {
744746
cm.createDirContext(USER_DN, "password".getBytes());
745747
fail("Expected NamingException.");
746748
} catch (NamingException e) {
747-
// javax.naming.NamingException: LDAP response read timed out, timeout used:100ms.
749+
// javax.naming.NamingException: LDAP response read timed out, timeout used:500ms.
748750
time = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - time);
749751
assertTrue("Expected connect timeout to be " + expectedTimeout + " ms but was " + time,
750752
time >= expectedTimeout && time <= (expectedTimeout + 200));
751753
}
752754

753755
/*
754-
* Configure the context manager with a 500 ms connect timeout.
756+
* Configure the context manager with a 1000 ms connect timeout.
755757
*/
756-
expectedTimeout = 500L;
758+
expectedTimeout = 1000L;
757759
cm.setConnectTimeout(expectedTimeout);
758760
cm.initialize();
759761

@@ -762,7 +764,7 @@ public void connectTimeout() throws Exception {
762764
cm.createDirContext(USER_DN, "password".getBytes());
763765
fail("Expected NamingException.");
764766
} catch (NamingException e) {
765-
// javax.naming.NamingException: LDAP response read timed out, timeout used:500ms.
767+
// javax.naming.NamingException: LDAP response read timed out, timeout used:1000ms.
766768
time = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - time);
767769
assertTrue("Expected connect timeout to be " + expectedTimeout + " millisecond but was " + time,
768770
time >= expectedTimeout && time <= (expectedTimeout + 200));

0 commit comments

Comments
 (0)