This is an automated email from the ASF dual-hosted git repository.

khowe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 7ae273f  GEODE-6219: Add assertion to verify the OS commands really 
ran (#3017)
7ae273f is described below

commit 7ae273f6de9e4104bddec4872e771ed1292e450e
Author: Kenneth Howe <kh...@pivotal.io>
AuthorDate: Thu Dec 20 11:00:41 2018 -0800

    GEODE-6219: Add assertion to verify the OS commands really ran (#3017)
    
    GEODE-6219: Verify netstat and lsof commands run; prevent 
OutOfMemoryException failures
    
    - Failure of netstat command on the test instance was not being detected. 
Added assertions to verify the OS commands (netstat and lsof) really ran.
    
    - Disable the test with lsof to the console. Creation of large String 
objects containing the enitre output from "lsof" was caused OOME on small JVMs 
on CI tests workers.
    
    - Updated bug numbers on @Ignore'd tests
---
 .../management/internal/cli/NetstatDUnitTest.java  | 35 ++++++++++++++++++----
 1 file changed, 29 insertions(+), 6 deletions(-)

diff --git 
a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/NetstatDUnitTest.java
 
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/NetstatDUnitTest.java
index 3cdaf38..c0e1f99 100644
--- 
a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/NetstatDUnitTest.java
+++ 
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/NetstatDUnitTest.java
@@ -76,6 +76,9 @@ public class NetstatDUnitTest {
     CommandResult result = gfsh.executeCommand("netstat");
     assertThat(result.getStatus()).isEqualTo(Result.Status.OK);
 
+    // verify that the OS commands executed
+    assertThat(result.toString()).doesNotContain("Could not execute");
+
     String rawOutput = result.getMessageFromContent();
     String[] lines = rawOutput.split("\n");
 
@@ -89,6 +92,9 @@ public class NetstatDUnitTest {
     CommandResult result = gfsh.executeCommand("netstat --member=server-1");
     assertThat(result.getStatus()).isEqualTo(Result.Status.OK);
 
+    // verify that the OS commands executed
+    assertThat(result.toString()).doesNotContain("Could not execute");
+
     String rawOutput = result.getMessageFromContent();
     String[] lines = rawOutput.split("\n");
 
@@ -96,11 +102,15 @@ public class NetstatDUnitTest {
     
assertThat(lines[4].trim().split("[,\\s]+")).containsExactlyInAnyOrder("server-1");
   }
 
+  @Ignore("GEODE-6228")
   @Test
   public void testOutputToConsoleWithLsofForOneMember() throws Exception {
     CommandResult result = gfsh.executeCommand("netstat --member=server-1 
--with-lsof");
     assertThat(result.getStatus()).isEqualTo(Result.Status.OK);
 
+    // verify that the OS commands executed
+    assertThat(result.toString()).doesNotContain("Could not execute");
+
     String rawOutput = result.getMessageFromContent();
     String[] lines = rawOutput.split("\n");
 
@@ -122,6 +132,9 @@ public class NetstatDUnitTest {
       lines.add(scanner.nextLine());
     }
 
+    // verify that the OS commands executed
+    assertThat(lines.toString()).doesNotContain("Could not execute");
+
     assertThat(lines.size()).isGreaterThan(5);
     
assertThat(lines.get(4).trim().split("[,\\s]+")).containsExactlyInAnyOrder("locator-0",
         "server-1", "server-2");
@@ -141,6 +154,9 @@ public class NetstatDUnitTest {
       lines.add(scanner.nextLine());
     }
 
+    // verify that the OS commands executed
+    assertThat(lines.toString()).doesNotContain("Could not execute");
+
     assertThat(lines.size()).isGreaterThan(5);
     
assertThat(lines.get(4).trim().split("[,\\s]+")).containsExactly("server-1");
   }
@@ -159,30 +175,37 @@ public class NetstatDUnitTest {
       lines.add(scanner.nextLine());
     }
 
+    // verify that the OS commands executed
+    assertThat(lines.toString()).doesNotContain("Could not execute");
+
     assertThat(lines.size()).isGreaterThan(5);
     
assertThat(lines.get(4).trim().split("[,\\s]+")).containsExactlyInAnyOrder("locator-0",
         "server-1", "server-2");
     assertThat(lines).filteredOn(e -> e.contains("## lsof output 
##")).hasSize(1);
   }
 
-  @Ignore("GEODE-2488")
+  @Ignore("GEODE-6228")
   @Test
   public void testConnectToLocatorWithLargeCommandResponse() throws Exception {
     gfsh.connect(server0.getEmbeddedLocatorPort(), 
GfshCommandRule.PortType.locator);
-    gfsh.executeAndAssertThat(netStatLsofCommand).statusIsSuccess();
+    gfsh.executeAndAssertThat(netStatLsofCommand).statusIsSuccess()
+        .doesNotContainOutput("Could not execute");
   }
 
-  @Ignore("GEODE-2488")
+  @Ignore("GEODE-6228")
   @Test
   public void testConnectToJmxManagerOneWithLargeCommandResponse() throws 
Exception {
     gfsh.connect(server0.getJmxPort(), GfshCommandRule.PortType.jmxManager);
-    gfsh.executeAndAssertThat(netStatLsofCommand).statusIsSuccess();
+    gfsh.executeAndAssertThat(netStatLsofCommand).statusIsSuccess()
+        .doesNotContainOutput("Could not execute");
+
   }
 
-  @Ignore("GEODE-2488")
+  @Ignore("GEODE-6228")
   @Test
   public void testConnectToJmxManagerTwoWithLargeCommandResponse() throws 
Exception {
     gfsh.connect(server1.getJmxPort(), GfshCommandRule.PortType.jmxManager);
-    gfsh.executeAndAssertThat(netStatLsofCommand).statusIsSuccess();
+    gfsh.executeAndAssertThat(netStatLsofCommand).statusIsSuccess()
+        .doesNotContainOutput("Could not execute");
   }
 }

Reply via email to