You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/08/11 05:17:17 UTC

[GitHub] [hadoop-ozone] llemec commented on a change in pull request #1308: HDDS-1889 Add support for verifying multiline log entry

llemec commented on a change in pull request #1308:
URL: https://github.com/apache/hadoop-ozone/pull/1308#discussion_r468331432



##########
File path: hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/audit/TestOzoneAuditLogger.java
##########
@@ -143,7 +150,35 @@ public void notLogReadEvents() throws IOException {
     verifyNoLog();
   }
 
-  private void verifyLog(String expected) throws IOException {
+  /**
+   * Test to verify if multiline entries can be checked.
+   */
+
+  @Test
+  public void messageIncludesMultilineException() throws IOException {
+    String exceptionMessage = "Dummy exception message";
+    TestException testException = new TestException(exceptionMessage);
+    AuditMessage exceptionAuditMessage =
+        new AuditMessage.Builder()
+            .setUser(USER)
+            .atIp(IP_ADDRESS)
+            .forOperation(DummyAction.CREATE_VOLUME)
+            .withParams(PARAMS)
+            .withResult(FAILURE)
+            .withException(testException).build();
+    AUDIT.logWriteFailure(exceptionAuditMessage);
+    verifyLog(
+        "ERROR | OMAudit | user=john | "
+            + "ip=192.168.0.1 | op=CREATE_VOLUME "
+            + "{key1=value1, key2=value2} | ret=FAILURE",
+        "org.apache.hadoop.ozone.audit."
+            + "TestOzoneAuditLogger$TestException: Dummy exception message",
+        "at org.apache.hadoop.ozone.audit.TestOzoneAuditLogger"
+            + ".messageIncludesMultilineException"
+            + "(TestOzoneAuditLogger.java:160) [test-classes/:?]");

Review comment:
       @adoroszlai indeed, thank you for pointing that out. Fixed in latest commit.




----------------------------------------------------------------
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: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org