upthewaterspout commented on a change in pull request #5598:
URL: https://github.com/apache/geode/pull/5598#discussion_r500628520
##########
File path:
geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MembershipIntegrationTest.java
##########
@@ -272,6 +276,65 @@ public void secondMembershipPausesForLocatorWaitTime()
stop(coordinatorLocator, lateJoiningLocator);
}
+ @Test
+ public void locatorsStopWaitingForLocatorWaitTimeIfAllLocatorsContacted()
+ throws IOException, MemberStartupException, InterruptedException,
TimeoutException,
+ ExecutionException {
+
+ final Supplier<ExecutorService> executorServiceSupplier =
+ () -> LoggingExecutors.newCachedThreadPool("membership", false);
+
+ int[] locatorPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+
+ int locatorWaitTime = (int) Duration.ofMinutes(5).getSeconds();
+ final MembershipConfig config =
+ createMembershipConfig(true, locatorWaitTime, locatorPorts[0],
locatorPorts[1]);
+
+ CompletableFuture<Membership<MemberIdentifier>> createMembership0 =
+ launchLocator(executorServiceSupplier, locatorPorts[0], config);
+
+ // Assert that membership 0 is waiting for the other locator to start
+ Thread.sleep(5000);
+ assertThat(createMembership0.getNow(null)).isNull();
+
+ CompletableFuture<Membership<MemberIdentifier>> createMembership1 =
+ launchLocator(executorServiceSupplier, locatorPorts[1], config);
+
+ // Make sure the members are created in less than the locator-wait-time
+ Membership<MemberIdentifier> membership0 = createMembership0.get(2,
TimeUnit.MINUTES);
+ Membership<MemberIdentifier> membership1 = createMembership1.get(2,
TimeUnit.MINUTES);
+
+ // Make sure the members see each other in the view
+ assertThat(membership0.getView().getMembers()).hasSize(2);
+ assertThat(membership1.getView().getMembers()).hasSize(2);
+ }
Review comment:
Based on your comment I started down this road. But this is a test of
the whole membership system, so this will require injecting virtual time into a
whole lot of classes, including classes that are doing things like
`wait(sometimeout)` etc. I feel like this needs a little bit more time and
careful development to get right, and more than I want to shoehorn into this
PR.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]