Add diags for flaky CuratorModuleTest (#8528)

Add diagnostic messages to debug
CuratorModuleTest.exitsJvmWhenMaxRetriesExceeded() intermittent test
failures.
This commit is contained in:
Chi Cao Minh 2019-09-14 11:55:26 -07:00 committed by Fangjin Yang
parent df14e5d696
commit 5f39ee21ff
1 changed files with 4 additions and 3 deletions

View File

@ -149,8 +149,9 @@ public final class CuratorModuleTest
List<LogEvent> loggingEvents = logger.getLogEvents();
Assert.assertFalse(loggingEvents.isEmpty());
LogEvent logEvent = loggingEvents.get(0);
Assert.assertEquals(Level.ERROR, logEvent.getLevel());
Assert.assertEquals("Unhandled error in Curator Framework", logEvent.getMessage().getFormattedMessage());
String message = "Logging events: " + loggingEvents;
Assert.assertEquals(message, Level.ERROR, logEvent.getLevel());
Assert.assertEquals(message, "Unhandled error in Curator Framework", logEvent.getMessage().getFormattedMessage());
}
@Ignore("Verifies changes in https://github.com/apache/incubator-druid/pull/8458, but overkill for regular testing")
@ -187,7 +188,7 @@ public final class CuratorModuleTest
CuratorFramework curatorFramework = injector.getInstance(CuratorFramework.class);
RetryPolicy retryPolicy = curatorFramework.getZookeeperClient().getRetryPolicy();
Assert.assertThat(retryPolicy, CoreMatchers.instanceOf(ExponentialBackoffRetry.class));
RetryPolicy adjustedRetryPolicy = adjustRetryPolicy((BoundedExponentialBackoffRetry) retryPolicy, 0);
RetryPolicy adjustedRetryPolicy = adjustRetryPolicy((BoundedExponentialBackoffRetry) retryPolicy, maxRetries);
curatorFramework.getZookeeperClient().setRetryPolicy(adjustedRetryPolicy);
return curatorFramework;
}