Browse Source

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 <ismael@juma.me.uk>

Reviewers: Rajini Sivaram <rajinisivaram@googlemail.com>

Closes #3182 from ijuma/fix-controller-failover-flakiness
pull/3056/merge
Ismael Juma 8 years ago
parent
commit
eeb8f67810
  1. 2
      core/src/test/scala/unit/kafka/controller/ControllerFailoverTest.scala

2
core/src/test/scala/unit/kafka/controller/ControllerFailoverTest.scala

@ -81,7 +81,7 @@ class ControllerFailoverTest extends KafkaServerTestHarness with Logging { @@ -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])

Loading…
Cancel
Save