You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/05/28 17:16:52 UTC

[GitHub] [geode] jchen21 commented on a change in pull request #5162: GEODE-6070: Fix ShutdownCommandOverHttpDUnitTest flakiness

jchen21 commented on a change in pull request #5162:
URL: https://github.com/apache/geode/pull/5162#discussion_r431997075



##########
File path: geode-web/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ShutdownCommandOverHttpDUnitTest.java
##########
@@ -96,48 +93,61 @@ public void setup() throws Exception {
 
     locatorString = "localhost[" + locatorPort + "]";
 
-    locator.invoke(
-        () -> startLocator(locatorDir, locatorPort, locatorJmxPort, locatorHttpPort));
+    locator.invoke(() -> startLocator(locatorDir, locatorPort, locatorJmxPort, locatorHttpPort));
     server1.invoke(() -> startServer(SERVER1_NAME, server1Dir, locatorString));
     server2.invoke(() -> startServer(SERVER2_NAME, server2Dir, locatorString));
 
     gfsh.connectAndVerify(locatorHttpPort, PortType.http);
+
+    addIgnoredException(DistributedSystemDisconnectedException.class);
   }
 
   @Test
   public void testShutdownServers() {
     String command = "shutdown";
 
-    gfsh.executeAndAssertThat(command).statusIsSuccess().containsOutput("Shutdown is triggered");
+    gfsh.executeAndAssertThat(command)
+        .statusIsSuccess()
+        .containsOutput("Shutdown is triggered");
 
     for (VM vm : toArray(server1, server2)) {
       vm.invoke(() -> verifyNotConnected(SERVER_LAUNCHER.get().getCache()));
     }
 
-    gfsh.executeAndAssertThat("list members").statusIsSuccess();
+    gfsh.executeAndAssertThat("list members")
+        .statusIsSuccess();
+
     assertThat(gfsh.getGfshOutput()).contains("locator");
   }
 
   @Test
   public void testShutdownAll() {
     String command = "shutdown --include-locators=true";
 
-    gfsh.executeAndAssertThat(command).statusIsSuccess().containsOutput("Shutdown is triggered");
+    gfsh.executeAndAssertThat(command)
+        .statusIsSuccess()
+        .containsOutput("Shutdown is triggered");
+
     server1.invoke(() -> verifyNotConnected(SERVER_LAUNCHER.get().getCache()));
     server2.invoke(() -> verifyNotConnected(SERVER_LAUNCHER.get().getCache()));
     locator.invoke(() -> verifyNotConnected(LOCATOR_LAUNCHER.get().getCache()));
   }
 
   private void verifyNotConnected(Cache cache) {
-    await().untilAsserted(() -> assertThat(cache.getDistributedSystem().isConnected()).isFalse());
+    await().untilAsserted(() -> {
+      assertThat(cache.getDistributedSystem().isConnected())
+          .as("cache.getDistributedSystem().isConnected()")

Review comment:
       Is it preferable to use `withFailMessage` than `as` for this case?




----------------------------------------------------------------
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:
users@infra.apache.org