You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by ji...@apache.org on 2020/11/04 22:30:51 UTC

[helix] branch master updated: fix TestCleanupExternalView.test (#1492)

This is an automated email from the ASF dual-hosted git repository.

jiajunwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new 26ff60b  fix TestCleanupExternalView.test  (#1492)
26ff60b is described below

commit 26ff60bc044ba9d6ea5a21384ca0c7d3ba26e2f6
Author: kaisun2000 <52...@users.noreply.github.com>
AuthorDate: Wed Nov 4 14:27:25 2020 -0800

    fix TestCleanupExternalView.test  (#1492)
    
    Flaky test with 10 * 100ms. This may not be enough when there is logging or Zk is slow in github. Fix with TestHelper.verify();
    
    Co-authored-by: Kai Sun <ks...@ksun-mn1.linkedin.biz>
---
 .../helix/integration/TestCleanupExternalView.java      | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestCleanupExternalView.java b/helix-core/src/test/java/org/apache/helix/integration/TestCleanupExternalView.java
index 0e56652..c8b1450 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestCleanupExternalView.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestCleanupExternalView.java
@@ -42,6 +42,7 @@ import org.testng.annotations.Test;
  * orphan external-view
  */
 public class TestCleanupExternalView extends ZkUnitTestBase {
+  private ExternalView _externalView = null;
   @Test
   public void test() throws Exception {
     // Logger.getRootLogger().setLevel(Level.INFO);
@@ -109,18 +110,12 @@ public class TestCleanupExternalView extends ZkUnitTestBase {
     // System.out.println("re-enabling controller");
     admin.enableCluster(clusterName, true);
 
-    ExternalView externalView = null;
-    for (int i = 0; i < 10; i++) {
-      Thread.sleep(100);
-      externalView = accessor.getProperty(keyBuilder.externalView("TestDB0"));
-      // System.out.println("externalView: " + externalView);
-      if (externalView == null) {
-        break;
-      }
-    }
+    result = TestHelper.verify(() -> {
+      _externalView = accessor.getProperty(keyBuilder.externalView("TestDB0"));
+      return _externalView == null;
+    }, TestHelper.WAIT_DURATION);
 
-    Assert.assertNull(externalView, "external-view for TestDB0 should be removed, but was: "
-        + externalView);
+    Assert.assertTrue(result, "external-view for TestDB0 should be removed, but was: " + _externalView);
 
     // clean up
     controller.syncStop();