Increase timeout for DnsNameResolverTest

Motivation:
DnsNameResolverTest has been observed to timeout on the CI servers. We should increase the timeout from 5 seconds to 30 seconds.

Modifications:
- Increase timeout from 5 to 30 seconds.

Result:
Less false failures due to slower CI machines.
This commit is contained in:
Scott Mitchell 2017-07-18 19:29:55 -07:00 committed by Norman Maurer
parent d125adec38
commit 0afe4e0964

View File

@ -94,6 +94,7 @@ import static org.junit.Assert.fail;
public class DnsNameResolverTest { public class DnsNameResolverTest {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(DnsNameResolver.class); private static final InternalLogger logger = InternalLoggerFactory.getInstance(DnsNameResolver.class);
private static final long DEFAULT_TEST_TIMEOUT_MS = 30000;
// Using the top-100 web sites ranked in Alexa.com (Oct 2014) // Using the top-100 web sites ranked in Alexa.com (Oct 2014)
// Please use the following series of shell commands to get this up-to-date: // Please use the following series of shell commands to get this up-to-date:
@ -474,12 +475,12 @@ public class DnsNameResolverTest {
} }
} }
@Test(timeout = 5000) @Test(timeout = DEFAULT_TEST_TIMEOUT_MS)
public void testNonCachedResolveEmptyHostName() throws Exception { public void testNonCachedResolveEmptyHostName() throws Exception {
testNonCachedResolveEmptyHostName(""); testNonCachedResolveEmptyHostName("");
} }
@Test(timeout = 5000) @Test(timeout = DEFAULT_TEST_TIMEOUT_MS)
public void testNonCachedResolveNullHostName() throws Exception { public void testNonCachedResolveNullHostName() throws Exception {
testNonCachedResolveEmptyHostName(null); testNonCachedResolveEmptyHostName(null);
} }
@ -494,12 +495,12 @@ public class DnsNameResolverTest {
} }
} }
@Test(timeout = 5000) @Test(timeout = DEFAULT_TEST_TIMEOUT_MS)
public void testNonCachedResolveAllEmptyHostName() throws Exception { public void testNonCachedResolveAllEmptyHostName() throws Exception {
testNonCachedResolveAllEmptyHostName(""); testNonCachedResolveAllEmptyHostName("");
} }
@Test(timeout = 5000) @Test(timeout = DEFAULT_TEST_TIMEOUT_MS)
public void testNonCachedResolveAllNullHostName() throws Exception { public void testNonCachedResolveAllNullHostName() throws Exception {
testNonCachedResolveAllEmptyHostName(null); testNonCachedResolveAllEmptyHostName(null);
} }
@ -642,7 +643,7 @@ public class DnsNameResolverTest {
}; };
negativeLookupThread.start(); negativeLookupThread.start();
negativeLookupThread.join(5000); negativeLookupThread.join(DEFAULT_TEST_TIMEOUT_MS);
if (negativeLookupThread.isAlive()) { if (negativeLookupThread.isAlive()) {
negativeLookupThread.interrupt(); negativeLookupThread.interrupt();
@ -788,12 +789,12 @@ public class DnsNameResolverTest {
} }
} }
@Test(timeout = 5000) @Test(timeout = DEFAULT_TEST_TIMEOUT_MS)
public void secondDnsServerShouldBeUsedBeforeCNAMEFirstServerNotStarted() throws IOException { public void secondDnsServerShouldBeUsedBeforeCNAMEFirstServerNotStarted() throws IOException {
secondDnsServerShouldBeUsedBeforeCNAME(false); secondDnsServerShouldBeUsedBeforeCNAME(false);
} }
@Test(timeout = 5000) @Test(timeout = DEFAULT_TEST_TIMEOUT_MS)
public void secondDnsServerShouldBeUsedBeforeCNAMEFirstServerFailResolve() throws IOException { public void secondDnsServerShouldBeUsedBeforeCNAMEFirstServerFailResolve() throws IOException {
secondDnsServerShouldBeUsedBeforeCNAME(true); secondDnsServerShouldBeUsedBeforeCNAME(true);
} }
@ -852,7 +853,7 @@ public class DnsNameResolverTest {
} }
} }
@Test(timeout = 5000) @Test(timeout = DEFAULT_TEST_TIMEOUT_MS)
public void aAndAAAAQueryShouldTryFirstDnsServerBeforeSecond() throws IOException { public void aAndAAAAQueryShouldTryFirstDnsServerBeforeSecond() throws IOException {
final String knownHostName = "netty.io"; final String knownHostName = "netty.io";
final TestDnsServer dnsServer1 = new TestDnsServer(new HashSet<String>(Arrays.asList("notnetty.com"))); final TestDnsServer dnsServer1 = new TestDnsServer(new HashSet<String>(Arrays.asList("notnetty.com")));