GEODE-3333: GMSJoinLeaveJUnitTest.testViewNotSentWhenShuttingDown fails Moved assertion to remove race condition. The test wanted to confirm that the object under test thought it was membership coordinator and then check to see if it decided to stop being coordinator. If the background thread did this quickly enough the first condition would never be seen by the test.
Since the object under test was the coordinator immediately after setup there was no need to delay the assertion until after removing other members from the view. Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/b218ca30 Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/b218ca30 Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/b218ca30 Branch: refs/heads/feature/GEODE-3299 Commit: b218ca30bd447afffbb5da6360219a61c84ffe8a Parents: 3236416 Author: Bruce Schuchardt <[email protected]> Authored: Tue Aug 1 13:34:34 2017 -0700 Committer: Bruce Schuchardt <[email protected]> Committed: Tue Aug 1 13:37:36 2017 -0700 ---------------------------------------------------------------------- .../internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/geode/blob/b218ca30/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java index 2807be3..7c2033a 100644 --- a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java +++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java @@ -1145,6 +1145,7 @@ public class GMSJoinLeaveJUnitTest { mockMembers[2], gmsJoinLeaveMemberId, mockMembers[3])); assertTrue(gmsJoinLeave.getViewCreator().isAlive()); + assertTrue(testLocator.isCoordinator); when(manager.shutdownInProgress()).thenReturn(Boolean.TRUE); for (int i = 1; i < 4; i++) { @@ -1154,8 +1155,6 @@ public class GMSJoinLeaveJUnitTest { gmsJoinLeave.processMessage(msg); } - assertTrue(testLocator.isCoordinator); - Awaitility.await("waiting for view creator to stop").atMost(5000, MILLISECONDS) .until(() -> !gmsJoinLeave.getViewCreator().isAlive()); assertEquals(1, gmsJoinLeave.getView().getViewId());
