kafka-commits mailing list archives

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

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


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

commit d2c870b468c1b84fb372ef7d9681efe84783c3b8
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 bece78b..e2f50b9 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