Merge pull request #1075 from metamx/fix-test-timeout

increase test timeouts on DruidClusterBridgeTest
This commit is contained in:
Fangjin Yang 2015-01-30 14:31:32 -08:00
commit 14837d7808
1 changed files with 10 additions and 6 deletions

View File

@ -55,6 +55,10 @@ import java.util.concurrent.atomic.AtomicReference;
*/ */
public class DruidClusterBridgeTest public class DruidClusterBridgeTest
{ {
public static final int WAIT_MAX_RETRY = 100;
public static final int WAIT_SLEEP_MILLIS = 200;
@Test @Test
public void testRun() throws Exception public void testRun() throws Exception
{ {
@ -193,33 +197,33 @@ public class DruidClusterBridgeTest
int retry = 0; int retry = 0;
while (!bridge.isLeader()) { while (!bridge.isLeader()) {
if (retry > 5) { if (retry > WAIT_MAX_RETRY) {
throw new ISE("Unable to become leader"); throw new ISE("Unable to become leader");
} }
Thread.sleep(100); Thread.sleep(WAIT_SLEEP_MILLIS);
retry++; retry++;
} }
String path = "/druid/announcements/localhost:8080"; String path = "/druid/announcements/localhost:8080";
retry = 0; retry = 0;
while (remoteCf.checkExists().forPath(path) == null) { while (remoteCf.checkExists().forPath(path) == null) {
if (retry > 5) { if (retry > WAIT_MAX_RETRY) {
throw new ISE("Unable to announce"); throw new ISE("Unable to announce");
} }
Thread.sleep(100); Thread.sleep(WAIT_SLEEP_MILLIS);
retry++; retry++;
} }
boolean verified = verifyUpdate(jsonMapper, path, remoteCf); boolean verified = verifyUpdate(jsonMapper, path, remoteCf);
retry = 0; retry = 0;
while (!verified) { while (!verified) {
if (retry > 5) { if (retry > WAIT_MAX_RETRY) {
throw new ISE("No updates to bridge node occurred"); throw new ISE("No updates to bridge node occurred");
} }
Thread.sleep(100); Thread.sleep(WAIT_SLEEP_MILLIS);
retry++; retry++;
verified = verifyUpdate(jsonMapper, path, remoteCf); verified = verifyUpdate(jsonMapper, path, remoteCf);