Repository: kafka Updated Branches: refs/heads/trunk dc5bf4bd4 -> eeb8f6781
MINOR: Use `waitUntil` to fix transient failures of ControllerFailoverTest Without it, it's possible that the assertion is checked before the exception is thrown in the callback. Author: Ismael Juma <[email protected]> Reviewers: Rajini Sivaram <[email protected]> Closes #3182 from ijuma/fix-controller-failover-flakiness Project: http://git-wip-us.apache.org/repos/asf/kafka/repo Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/eeb8f678 Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/eeb8f678 Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/eeb8f678 Branch: refs/heads/trunk Commit: eeb8f67810e2b02ee73eeb3a784e365b7b780f47 Parents: dc5bf4b Author: Ismael Juma <[email protected]> Authored: Wed May 31 23:47:11 2017 +0100 Committer: Ismael Juma <[email protected]> Committed: Wed May 31 23:47:11 2017 +0100 ---------------------------------------------------------------------- .../test/scala/unit/kafka/controller/ControllerFailoverTest.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kafka/blob/eeb8f678/core/src/test/scala/unit/kafka/controller/ControllerFailoverTest.scala ---------------------------------------------------------------------- diff --git a/core/src/test/scala/unit/kafka/controller/ControllerFailoverTest.scala b/core/src/test/scala/unit/kafka/controller/ControllerFailoverTest.scala index c17ec6a..13b7285 100644 --- a/core/src/test/scala/unit/kafka/controller/ControllerFailoverTest.scala +++ b/core/src/test/scala/unit/kafka/controller/ControllerFailoverTest.scala @@ -81,7 +81,7 @@ class ControllerFailoverTest extends KafkaServerTestHarness with Logging { TestUtils.waitUntilTrue(() => !initialController.kafkaScheduler.isStarted, "Scheduler was not shutdown") TestUtils.waitUntilTrue(() => !initialController.isActive, "Controller did not become inactive") latch.countDown() - assertTrue("handleIllegalState did not throw an exception", exceptionThrown.isDefined) + TestUtils.waitUntilTrue(() => exceptionThrown.isDefined, "handleIllegalState did not throw an exception") assertTrue(s"handleIllegalState should throw an IllegalStateException, but $exceptionThrown was thrown", exceptionThrown.get.isInstanceOf[IllegalStateException])
