kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ij...@apache.org
Subject [kafka] branch 2.1 updated: MINOR: Fix flaky assertion in ControllerIntegrationTest (#5829)
Date Wed, 24 Oct 2018 20:23:15 GMT
This is an automated email from the ASF dual-hosted git repository.

ijuma pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/2.1 by this push:
     new e6b2027  MINOR: Fix flaky assertion in ControllerIntegrationTest (#5829)
e6b2027 is described below

commit e6b20272f56dd6ddaf6d47a23900ed7f26ff76dd
Author: Stanislav Kozlovski <stanislav_kozlovski@outlook.com>
AuthorDate: Wed Oct 24 23:22:02 2018 +0300

    MINOR: Fix flaky assertion in ControllerIntegrationTest (#5829)
    
    `ControllerIntegrationTest#waitUntilControllerEpoch` sometimes fails with the following
error:
    
    ```
    java.util.NoSuchElementException: None.get
    	at scala.None$.get(Option.scala:347)
    	at scala.None$.get(Option.scala:345)
    	at kafka.controller.ControllerIntegrationTest$$anonfun$waitUntilControllerEpoch$1.apply$mcZ$sp(ControllerIntegrationTest.scala:312)
    	at kafka.utils.TestUtils$.waitUntilTrue(TestUtils.scala:779)
    	at kafka.controller.ControllerIntegrationTest.waitUntilControllerEpoch(ControllerIntegrationTest.scala:312)
    	at kafka.controller.ControllerIntegrationTest.testEmptyCluster(ControllerIntegrationTest.scala:51)
    ```
    
    We should retry until the value is defined or it times out.
    
    Reviewers: Ismael Juma <ismael@juma.me.uk>
---
 .../test/scala/unit/kafka/controller/ControllerIntegrationTest.scala    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/src/test/scala/unit/kafka/controller/ControllerIntegrationTest.scala b/core/src/test/scala/unit/kafka/controller/ControllerIntegrationTest.scala
index dc4076a..e7cf9a3 100644
--- a/core/src/test/scala/unit/kafka/controller/ControllerIntegrationTest.scala
+++ b/core/src/test/scala/unit/kafka/controller/ControllerIntegrationTest.scala
@@ -451,7 +451,7 @@ class ControllerIntegrationTest extends ZooKeeperTestHarness {
   }
 
   private def waitUntilControllerEpoch(epoch: Int, message: String): Unit = {
-    TestUtils.waitUntilTrue(() => zkClient.getControllerEpoch.get._1 == epoch, message)
+    TestUtils.waitUntilTrue(() => zkClient.getControllerEpoch.map(_._1).contains(epoch)
, message)
   }
 
   private def waitForPartitionState(tp: TopicPartition,


Mime
View raw message