helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zzh...@apache.org
Subject git commit: HELIX-41: fix intermittent test failures
Date Mon, 04 Feb 2013 02:17:11 GMT
Updated Branches:
  refs/heads/master 03423e624 -> c744c1b8b


HELIX-41: fix intermittent 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/c744c1b8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-helix/tree/c744c1b8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-helix/diff/c744c1b8

Branch: refs/heads/master
Commit: c744c1b8b457488e48ef1cc08193662e61722e89
Parents: 03423e6
Author: zzhang <zzhang5@uci.edu>
Authored: Sun Feb 3 18:17:01 2013 -0800
Committer: zzhang <zzhang5@uci.edu>
Committed: Sun Feb 3 18:17:01 2013 -0800

----------------------------------------------------------------------
 .../manager/zk/TestZkCacheAsyncOpSingleThread.java |   14 +++++++++-----
 .../helix/store/zk/TestZkHelixPropertyStore.java   |   15 ++++++++++++---
 2 files changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/c744c1b8/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkCacheAsyncOpSingleThread.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkCacheAsyncOpSingleThread.java
b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkCacheAsyncOpSingleThread.java
index 950a47d..9205282 100644
--- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkCacheAsyncOpSingleThread.java
+++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkCacheAsyncOpSingleThread.java
@@ -106,16 +106,20 @@ public class TestZkCacheAsyncOpSingleThread extends ZkUnitTestBase
     }
 
     // wait zkEventThread update zkCache
-    Thread.sleep(100);
-
     // verify wtCache
-    // TestHelper.printCache(accessor._zkCache);
-
-    ret =
+    for (int i = 0; i < 10; i++)
+    {
+        // TestHelper.printCache(accessor._zkCache);
+    	ret =
         TestHelper.verifyZkCache(zkCacheInitPaths,
                                  accessor._zkCache._cache,
                                  _gZkClient,
                                  true);
+    	if (ret == true)
+    		break;
+        Thread.sleep(100);
+    }
+    
     // System.out.println("ret: " + ret);
     Assert.assertTrue(ret, "zkCache doesn't match data on Zk");
 

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/c744c1b8/helix-core/src/test/java/org/apache/helix/store/zk/TestZkHelixPropertyStore.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/store/zk/TestZkHelixPropertyStore.java
b/helix-core/src/test/java/org/apache/helix/store/zk/TestZkHelixPropertyStore.java
index 5b358a2..8c5157e 100644
--- a/helix-core/src/test/java/org/apache/helix/store/zk/TestZkHelixPropertyStore.java
+++ b/helix-core/src/test/java/org/apache/helix/store/zk/TestZkHelixPropertyStore.java
@@ -116,7 +116,8 @@ public class TestZkHelixPropertyStore extends ZkUnitTestBase
     }
     long endT = System.currentTimeMillis();
     System.out.println("1000 Get() time used: " + (endT - startT) + "ms");
-    Assert.assertTrue((endT - startT) < 60, "1000 Gets should be finished within 50ms");
+    long latency = endT - startT;
+    Assert.assertTrue(latency < 100, "1000 Gets should be finished within 100ms, but was
" + latency + " ms");
 
     store.stop();
     System.out.println("END testSet() at " + new Date(System.currentTimeMillis()));
@@ -171,7 +172,11 @@ public class TestZkHelixPropertyStore extends ZkUnitTestBase
     int expectDeleteNodes = 1 + firstLevelNr + firstLevelNr * secondLevelNr;
     store.remove("/", 0);
     // wait until all callbacks have been received
-    Thread.sleep(500);
+    for (int i = 0; i < 10; i++) {
+    	if (listener._deleteKeys.size() == expectDeleteNodes)
+    		break;
+    	Thread.sleep(500);
+    }
 
     System.out.println("createKey#:" + listener._createKeys.size() + ", changeKey#:"
         + listener._changeKeys.size() + ", deleteKey#:" + listener._deleteKeys.size());
@@ -216,7 +221,11 @@ public class TestZkHelixPropertyStore extends ZkUnitTestBase
     listener.reset();
     setNodes(_gZkClient, subRoot, 'b', true);
     int expectChangeNodes = firstLevelNr * secondLevelNr;
-    Thread.sleep(500);
+    for (int i = 0; i < 10; i++) {
+    	if (listener._changeKeys.size() >= expectChangeNodes)
+    		break;
+    	Thread.sleep(500);
+    }
 
     System.out.println("createKey#:" + listener._createKeys.size() + ", changeKey#:"
         + listener._changeKeys.size() + ", deleteKey#:" + listener._deleteKeys.size());


Mime
View raw message