You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@twill.apache.org by ch...@apache.org on 2015/05/22 03:23:49 UTC

incubator-twill git commit: Fix a race condition in ZKClientTest that may cause test failure

Repository: incubator-twill
Updated Branches:
  refs/heads/master 86017426d -> beb888297


Fix a race condition in ZKClientTest that may cause test failure

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

Branch: refs/heads/master
Commit: beb888297f4362ed0522ed487713f7ebab6abb55
Parents: 8601742
Author: Terence Yim <ch...@apache.org>
Authored: Thu May 21 18:23:38 2015 -0700
Committer: Terence Yim <ch...@apache.org>
Committed: Thu May 21 18:23:38 2015 -0700

----------------------------------------------------------------------
 .../test/java/org/apache/twill/zookeeper/ZKClientTest.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-twill/blob/beb88829/twill-zookeeper/src/test/java/org/apache/twill/zookeeper/ZKClientTest.java
----------------------------------------------------------------------
diff --git a/twill-zookeeper/src/test/java/org/apache/twill/zookeeper/ZKClientTest.java b/twill-zookeeper/src/test/java/org/apache/twill/zookeeper/ZKClientTest.java
index c9e7e58..97dec03 100644
--- a/twill-zookeeper/src/test/java/org/apache/twill/zookeeper/ZKClientTest.java
+++ b/twill-zookeeper/src/test/java/org/apache/twill/zookeeper/ZKClientTest.java
@@ -203,7 +203,12 @@ public class ZKClientTest {
 
         Assert.assertTrue(expireReconnectLatch.await(60, TimeUnit.SECONDS));
 
-        client.delete("/expireRewatch");
+        // Keep trying to delete the node until it succeed
+        while (ZKOperations.ignoreError(client.delete("/expireRewatch"), KeeperException.class, null).get() == null) {
+          LOG.info("Delete failed. Retrying to delete /expireRewatch");
+          TimeUnit.MILLISECONDS.sleep(10);
+        }
+
         Assert.assertEquals(Watcher.Event.EventType.NodeDeleted, events.poll(60, TimeUnit.SECONDS));
       } finally {
         client.stopAndWait();