You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2017/08/19 00:10:18 UTC

[23/51] [abbrv] geode git commit: GEODE-3427 CI failure in GMSJoinLeaveJUnitTest.testCoordinatorFindRequestSuccess

GEODE-3427 CI failure in GMSJoinLeaveJUnitTest.testCoordinatorFindRequestSuccess

Removed use of background threads and modified the test to focus on
the method findCoordinator.  This is what the name of the test implies
that is validating.


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/91430e12
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/91430e12
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/91430e12

Branch: refs/heads/feature/GEODE-1279
Commit: 91430e122bdd9a6add219914a5175fddadf4ecf1
Parents: d291a45
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Wed Aug 16 15:05:06 2017 -0700
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Wed Aug 16 15:06:45 2017 -0700

----------------------------------------------------------------------
 .../membership/gms/membership/GMSJoinLeave.java |  2 +-
 .../gms/membership/GMSJoinLeaveJUnitTest.java   | 25 +++++---------------
 2 files changed, 7 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/91430e12/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
index c63c30f..cba95f9 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
@@ -1069,7 +1069,7 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
    * This contacts the locators to find out who the current coordinator is. All locators are
    * contacted. If they don't agree then we choose the oldest coordinator and return it.
    */
-  private boolean findCoordinator() {
+  boolean findCoordinator() {
     SearchState state = searchState;
 
     assert this.localAddress != null;

http://git-wip-us.apache.org/repos/asf/geode/blob/91430e12/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 1acb989..f4bdbbf 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
@@ -36,7 +36,6 @@ import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.distributed.internal.membership.NetView;
 import org.apache.geode.distributed.internal.membership.gms.GMSMember;
-import org.apache.geode.distributed.internal.membership.gms.GMSUtil;
 import org.apache.geode.distributed.internal.membership.gms.ServiceConfig;
 import org.apache.geode.distributed.internal.membership.gms.Services;
 import org.apache.geode.distributed.internal.membership.gms.Services.Stopper;
@@ -68,8 +67,6 @@ import org.junit.Assert;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.mockito.internal.verification.Times;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
 import org.mockito.verification.Timeout;
 
 import java.io.IOException;
@@ -1222,7 +1219,6 @@ public class GMSJoinLeaveJUnitTest {
   }
 
   @Test
-  @Category(FlakyTest.class) // GEODE-3427 - intermittent CI failures
   public void testCoordinatorFindRequestSuccess() throws Exception {
     initMocks(false);
     HashSet<InternalDistributedMember> registrants = new HashSet<>();
@@ -1230,25 +1226,16 @@ public class GMSJoinLeaveJUnitTest {
     FindCoordinatorResponse fcr = new FindCoordinatorResponse(mockMembers[0], mockMembers[0], false,
         null, registrants, false, true, null);
     NetView view = createView();
-    JoinResponseMessage jrm = new JoinResponseMessage(mockMembers[0], view, 0);
 
     TcpClientWrapper tcpClientWrapper = mock(TcpClientWrapper.class);
     gmsJoinLeave.setTcpClientWrapper(tcpClientWrapper);
-    FindCoordinatorRequest fcreq =
-        new FindCoordinatorRequest(gmsJoinLeaveMemberId, new HashSet<>(), -1, null, 0, "");
-    int connectTimeout = (int) services.getConfig().getMemberTimeout() * 2;
-    when(tcpClientWrapper.sendCoordinatorFindRequest(new InetSocketAddress("localhost", 12345),
-        fcreq, connectTimeout)).thenReturn(fcr);
-    callAsnyc(() -> {
-      gmsJoinLeave.installView(view);
-    });
-    Awaitility.await().atMost(10, TimeUnit.SECONDS)
-        .until(() -> assertTrue("Should be able to join ", gmsJoinLeave.join()));
-  }
 
-  private void callAsnyc(Runnable run) {
-    Thread th = new Thread(run);
-    th.start();
+    when(tcpClientWrapper.sendCoordinatorFindRequest(isA(InetSocketAddress.class),
+        isA(FindCoordinatorRequest.class), isA(Integer.class))).thenReturn(fcr);
+
+    boolean foundCoordinator = gmsJoinLeave.findCoordinator();
+    assertTrue(gmsJoinLeave.searchState.toString(), foundCoordinator);
+    assertEquals(gmsJoinLeave.searchState.possibleCoordinator, mockMembers[0]);
   }
 
   @Test