[ 
https://issues.apache.org/jira/browse/GEODE-6070?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17119119#comment-17119119
 ] 

ASF GitHub Bot commented on GEODE-6070:
---------------------------------------

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



##########
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:
       I use `as` to indicate an alias for the subject of the assertion, and 
`withFailMessage` as a full replacement of the failure message.
   
   `distributed system isConnected` is probably a better example of English for 
an `as` in this case. It's kind of interesting to compare the output when using 
`as` vs `withFailMessage`.
   
   Using `as`:
   ```
   org.junit.ComparisonFailure: [cache.getDistributedSystem().isConnected()] 
   Expected :false
   Actual   :true
    <Click to see difference>
   
   
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at 
org.apache.geode.test.awaitility.WithFailMessageTest.foo(WithFailMessageTest.java:79)
   ```
   Using `withFailMessage`:
   ```
   java.lang.AssertionError: cache.getDistributedSystem().isConnected()
   
        at 
org.apache.geode.test.awaitility.WithFailMessageTest.foo(WithFailMessageTest.java:79)
   ```
   So I only use `withFailMessage` if I want to actually suppress and replace 
the native assertion failure message.




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


> CI Failure: ShutdownCommandOverHttpDUnitTest > testShutdownAll
> --------------------------------------------------------------
>
>                 Key: GEODE-6070
>                 URL: https://issues.apache.org/jira/browse/GEODE-6070
>             Project: Geode
>          Issue Type: Bug
>    Affects Versions: 1.12.0
>            Reporter: Helena Bales
>            Assignee: Kirk Lund
>            Priority: Major
>              Labels: GeodeCommons, flaky
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Failed with stacktrace:
> {noformat}
> org.apache.geode.management.internal.cli.commands.ShutdownCommandOverHttpDUnitTest
>  > testShutdownAll FAILED
>     java.lang.AssertionError: Suspicious strings were written to the log 
> during this run.
>     Fix the strings or use IgnoredException.addIgnoredException to ignore.
>     -----------------------------------------------------------------------
>     Found suspect string in log4j at line 302
>     org.apache.geode.distributed.DistributedSystemDisconnectedException: 
> Distribution manager on 172.17.0.3(server-1:496)<v1>:41002 started at Thu Nov 
> 15 19:47:58 UTC 2018: Message distribution has terminated
> {noformat}
> Test results can be found here:
> http://files.apachegeode-ci.info/builds/apache-develop-main/1.9.0-build.158/test-results/distributedTest/1542315851/classes/org.apache.geode.management.internal.cli.commands.ShutdownCommandOverHttpDUnitTest.html#testShutdownAll
>  
> Test Artifacts can be found here:
> http://files.apachegeode-ci.info/builds/apache-develop-main/1.9.0-build.158/test-artifacts/1542315851/distributedtestfiles-OpenJDK8-1.9.0-build.158.tgz



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to