You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by sl...@apache.org on 2012/12/19 02:31:32 UTC

[3/3] git commit: [HELIX-7] Tune test parameters to fix random test failures

[HELIX-7] Tune test parameters to fix random test failures

Project: http://git-wip-us.apache.org/repos/asf/incubator-helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-helix/commit/747f21d5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-helix/tree/747f21d5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-helix/diff/747f21d5

Branch: refs/heads/master
Commit: 747f21d5814a831a85cc970cb0c2670e753e5ea2
Parents: dbdf5d4
Author: slu2011 <lu...@gmail.com>
Authored: Mon Dec 17 17:25:17 2012 -0800
Committer: slu2011 <lu...@gmail.com>
Committed: Mon Dec 17 17:25:17 2012 -0800

----------------------------------------------------------------------
 .../apache/helix/healthcheck/TestDummyAlerts.java  |   16 +++++++++++++-
 ...tandAloneCMTestBaseWithPropertyServerCheck.java |   14 +++++++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/747f21d5/helix-core/src/test/java/org/apache/helix/healthcheck/TestDummyAlerts.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/healthcheck/TestDummyAlerts.java b/helix-core/src/test/java/org/apache/helix/healthcheck/TestDummyAlerts.java
index 1ec68cc..50a5125 100644
--- a/helix-core/src/test/java/org/apache/helix/healthcheck/TestDummyAlerts.java
+++ b/helix-core/src/test/java/org/apache/helix/healthcheck/TestDummyAlerts.java
@@ -138,8 +138,20 @@ public class TestDummyAlerts extends ZkIntegrationTestBase
     for (int i = 0; i < n; i++)
     {
       String instance = "localhost_" + (12918 + i);
-      ZNRecord record =
-          accessor.getProperty(keyBuilder.healthReport(instance, "mockAlerts")).getRecord();
+      ZNRecord record = null;
+      for(int j = 0; j < 10; j++)
+      {
+        record =
+            accessor.getProperty(keyBuilder.healthReport(instance, "mockAlerts")).getRecord();
+        if(record.getId().equals("mockAlerts4"))
+        {
+          break;
+        }
+        else
+        {
+          Thread.sleep(500);
+        }
+      }
       Assert.assertEquals(record.getId(), "mockAlerts4");
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/747f21d5/helix-core/src/test/java/org/apache/helix/integration/ZkStandAloneCMTestBaseWithPropertyServerCheck.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/ZkStandAloneCMTestBaseWithPropertyServerCheck.java b/helix-core/src/test/java/org/apache/helix/integration/ZkStandAloneCMTestBaseWithPropertyServerCheck.java
index c89fadd..bca59bf 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/ZkStandAloneCMTestBaseWithPropertyServerCheck.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/ZkStandAloneCMTestBaseWithPropertyServerCheck.java
@@ -57,6 +57,20 @@ public class ZkStandAloneCMTestBaseWithPropertyServerCheck extends ZkStandAloneC
         List<StatusUpdate> statusUpdates = accessor.getChildValues(
             kb.stateTransitionStatus(instanceName, _startCMResultMap.get(instanceName)._manager.getSessionId(),
                 TEST_DB));
+        for(int j = 0;j < 10; j++)
+        {
+          statusUpdates = accessor.getChildValues(
+            kb.stateTransitionStatus(instanceName, _startCMResultMap.get(instanceName)._manager.getSessionId(),
+                TEST_DB));
+          if(statusUpdates.size() == 0)
+          {
+            Thread.sleep(500);
+          }
+          else
+          {
+            break;
+          }
+        }
         Assert.assertTrue(statusUpdates.size() > 0);
         for(StatusUpdate update : statusUpdates)
         {