GEODE-857: Wait for watchdog threads to start in SystemFailureJUnitTest I can't reproduce this failure, but maybe it's possible the isAlive flag is not set immediately on all platforms. So we'll have the test wait for the threads to be alive, rather than assert.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/ac3d3b4c Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/ac3d3b4c Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/ac3d3b4c Branch: refs/heads/feature/GEODE-17-2 Commit: ac3d3b4c5294bbb64a54fef191584c6d4306de04 Parents: aed5e5f Author: Dan Smith <[email protected]> Authored: Thu Mar 17 14:23:05 2016 -0700 Committer: Dan Smith <[email protected]> Committed: Thu Mar 17 14:44:54 2016 -0700 ---------------------------------------------------------------------- .../test/java/com/gemstone/gemfire/SystemFailureJUnitTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ac3d3b4c/geode-core/src/test/java/com/gemstone/gemfire/SystemFailureJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/SystemFailureJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/SystemFailureJUnitTest.java index e33eba4..c5efaf0 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/SystemFailureJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/SystemFailureJUnitTest.java @@ -26,6 +26,7 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import com.gemstone.gemfire.test.junit.categories.UnitTest; +import com.jayway.awaitility.Awaitility; @Category(UnitTest.class) public class SystemFailureJUnitTest { @@ -48,8 +49,8 @@ public class SystemFailureJUnitTest { long start = System.nanoTime(); Thread watchDog = SystemFailure.getWatchDogForTest(); Thread proctor= SystemFailure.getProctorForTest(); - assertTrue(watchDog.isAlive()); - assertTrue(proctor.isAlive()); + Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -> watchDog.isAlive()); + Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -> proctor.isAlive()); SystemFailure.stopThreads(); long elapsed = System.nanoTime() - start; assertTrue("Waited too long to shutdown: " + elapsed, elapsed < TimeUnit.MILLISECONDS.toNanos(LONG_WAIT));
