You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2017/07/21 16:26:52 UTC

curator git commit: Avoid test flakiness by not starting the second migration until the first is in filter()

Repository: curator
Updated Branches:
  refs/heads/CURATOR-426 71ed99d3d -> 3ad6ca765


Avoid test flakiness by not starting the second migration until the first is in filter()


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/3ad6ca76
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/3ad6ca76
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/3ad6ca76

Branch: refs/heads/CURATOR-426
Commit: 3ad6ca7658b92d38417c47be536ddf3aa8dc61f1
Parents: 71ed99d
Author: randgalt <ra...@apache.org>
Authored: Fri Jul 21 11:26:47 2017 -0500
Committer: randgalt <ra...@apache.org>
Committed: Fri Jul 21 11:26:47 2017 -0500

----------------------------------------------------------------------
 .../apache/curator/x/async/migrations/TestMigrationManager.java  | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/3ad6ca76/curator-x-async/src/test/java/org/apache/curator/x/async/migrations/TestMigrationManager.java
----------------------------------------------------------------------
diff --git a/curator-x-async/src/test/java/org/apache/curator/x/async/migrations/TestMigrationManager.java b/curator-x-async/src/test/java/org/apache/curator/x/async/migrations/TestMigrationManager.java
index c781f60..063b961 100644
--- a/curator-x-async/src/test/java/org/apache/curator/x/async/migrations/TestMigrationManager.java
+++ b/curator-x-async/src/test/java/org/apache/curator/x/async/migrations/TestMigrationManager.java
@@ -67,6 +67,7 @@ public class TestMigrationManager extends CompletableBaseClassForTests
     private CuratorOp v3op;
     private MigrationManager manager;
     private final AtomicReference<CountDownLatch> filterLatch = new AtomicReference<>();
+    private final CountDownLatch filterIsSetLatch = new CountDownLatch(1);
 
     @BeforeMethod
     @Override
@@ -99,6 +100,7 @@ public class TestMigrationManager extends CompletableBaseClassForTests
                 CountDownLatch localLatch = filterLatch.getAndSet(null);
                 if ( localLatch != null )
                 {
+                    filterIsSetLatch.countDown();
                     try
                     {
                         localLatch.await();
@@ -301,6 +303,7 @@ public class TestMigrationManager extends CompletableBaseClassForTests
         CountDownLatch latch = new CountDownLatch(1);
         filterLatch.set(latch);
         CompletionStage<Void> first = manager.migrate(migrationSet);
+        Assert.assertTrue(timing.awaitLatch(filterIsSetLatch));
 
         MigrationManager manager2 = new MigrationManager(client, LOCK_PATH, META_DATA_PATH, executor, Duration.ofMillis(timing.forSleepingABit().milliseconds()));
         try
@@ -328,6 +331,7 @@ public class TestMigrationManager extends CompletableBaseClassForTests
         CountDownLatch latch = new CountDownLatch(1);
         filterLatch.set(latch);
         CompletionStage<Void> first = manager.migrate(migrationSet);
+        Assert.assertTrue(timing.awaitLatch(filterIsSetLatch));
 
         CompletionStage<Void> second = manager.migrate(migrationSet);
         try