From 0afe4e09643c457c452ef0d9563c46f8e7c24ad1 Mon Sep 17 00:00:00 2001 From: Scott Mitchell Date: Tue, 18 Jul 2017 19:29:55 -0700 Subject: [PATCH] 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. --- .../netty/resolver/dns/DnsNameResolverTest.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/resolver-dns/src/test/java/io/netty/resolver/dns/DnsNameResolverTest.java b/resolver-dns/src/test/java/io/netty/resolver/dns/DnsNameResolverTest.java index 33a793bce7..754282fd4f 100644 --- a/resolver-dns/src/test/java/io/netty/resolver/dns/DnsNameResolverTest.java +++ b/resolver-dns/src/test/java/io/netty/resolver/dns/DnsNameResolverTest.java @@ -94,6 +94,7 @@ import static org.junit.Assert.fail; public class DnsNameResolverTest { 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) // 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 { testNonCachedResolveEmptyHostName(""); } - @Test(timeout = 5000) + @Test(timeout = DEFAULT_TEST_TIMEOUT_MS) public void testNonCachedResolveNullHostName() throws Exception { testNonCachedResolveEmptyHostName(null); } @@ -494,12 +495,12 @@ public class DnsNameResolverTest { } } - @Test(timeout = 5000) + @Test(timeout = DEFAULT_TEST_TIMEOUT_MS) public void testNonCachedResolveAllEmptyHostName() throws Exception { testNonCachedResolveAllEmptyHostName(""); } - @Test(timeout = 5000) + @Test(timeout = DEFAULT_TEST_TIMEOUT_MS) public void testNonCachedResolveAllNullHostName() throws Exception { testNonCachedResolveAllEmptyHostName(null); } @@ -642,7 +643,7 @@ public class DnsNameResolverTest { }; negativeLookupThread.start(); - negativeLookupThread.join(5000); + negativeLookupThread.join(DEFAULT_TEST_TIMEOUT_MS); if (negativeLookupThread.isAlive()) { negativeLookupThread.interrupt(); @@ -788,12 +789,12 @@ public class DnsNameResolverTest { } } - @Test(timeout = 5000) + @Test(timeout = DEFAULT_TEST_TIMEOUT_MS) public void secondDnsServerShouldBeUsedBeforeCNAMEFirstServerNotStarted() throws IOException { secondDnsServerShouldBeUsedBeforeCNAME(false); } - @Test(timeout = 5000) + @Test(timeout = DEFAULT_TEST_TIMEOUT_MS) public void secondDnsServerShouldBeUsedBeforeCNAMEFirstServerFailResolve() throws IOException { secondDnsServerShouldBeUsedBeforeCNAME(true); } @@ -852,7 +853,7 @@ public class DnsNameResolverTest { } } - @Test(timeout = 5000) + @Test(timeout = DEFAULT_TEST_TIMEOUT_MS) public void aAndAAAAQueryShouldTryFirstDnsServerBeforeSecond() throws IOException { final String knownHostName = "netty.io"; final TestDnsServer dnsServer1 = new TestDnsServer(new HashSet(Arrays.asList("notnetty.com")));