kafka-commits mailing list archives

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

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


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

commit 03a2b266b617a8b6ba65d737e88966a4077dc7a5
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 88fe82b..f4f4039 100644
--- a/core/src/test/scala/unit/kafka/controller/ControllerIntegrationTest.scala
+++ b/core/src/test/scala/unit/kafka/controller/ControllerIntegrationTest.scala
@@ -309,7 +309,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