You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2020/09/10 23:41:18 UTC

[GitHub] [cassandra-in-jvm-dtest-api] dcapwell commented on a change in pull request #16: Include captured console output string in NodeToolResult

dcapwell commented on a change in pull request #16:
URL: https://github.com/apache/cassandra-in-jvm-dtest-api/pull/16#discussion_r486690846



##########
File path: src/main/java/org/apache/cassandra/distributed/api/NodeToolResult.java
##########
@@ -134,6 +144,30 @@ public Asserts notificationContains(ProgressEventType type, String msg)
             return this; // unreachable
         }
 
+        public Asserts capturedConsoleOutContains(String substring)

Review comment:
       maybe `stdoutContains` and `stderrContains`?  `capturedConsole` I don't feel is needed in the name

##########
File path: src/main/java/org/apache/cassandra/distributed/api/NodeToolResult.java
##########
@@ -134,6 +144,30 @@ public Asserts notificationContains(ProgressEventType type, String msg)
             return this; // unreachable
         }
 
+        public Asserts capturedConsoleOutContains(String substring)
+        {
+            return capturedConsoleOutputContains(substring, true);
+        }
+
+        public Asserts capturedConsoleErrContains(String substring)
+        {
+            return capturedConsoleOutputContains(substring, false);
+        }
+
+        private Asserts capturedConsoleOutputContains(String substring, boolean isOut)
+        {
+            String name = isOut ? "capturedConsoleOut" : "capturedConsoleErr";
+            String output = isOut ? capturedConsoleOut : capturedConsoleErr;
+            AssertUtils.assertNotNull(name + " not defined", output);
+            AssertUtils.assertFalse("Found no " + name, output.isEmpty());

Review comment:
       do we care about that, `""` does not contain `"match"` so the fail should be fine

##########
File path: src/main/java/org/apache/cassandra/distributed/api/NodeToolResult.java
##########
@@ -134,6 +144,30 @@ public Asserts notificationContains(ProgressEventType type, String msg)
             return this; // unreachable
         }
 
+        public Asserts capturedConsoleOutContains(String substring)
+        {
+            return capturedConsoleOutputContains(substring, true);
+        }
+
+        public Asserts capturedConsoleErrContains(String substring)
+        {
+            return capturedConsoleOutputContains(substring, false);
+        }
+
+        private Asserts capturedConsoleOutputContains(String substring, boolean isOut)
+        {
+            String name = isOut ? "capturedConsoleOut" : "capturedConsoleErr";
+            String output = isOut ? capturedConsoleOut : capturedConsoleErr;
+            AssertUtils.assertNotNull(name + " not defined", output);

Review comment:
       can only use these if-and-only-if the C* version supports capturing; fair as we can't throw `org.junit.AssumptionViolatedException` to skip the test




----------------------------------------------------------------
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



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org