hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [hadoop] adoroszlai commented on a change in pull request #1205: HDDS-1886. Use ArrayList#clear to address audit failure scenario
Date Thu, 01 Aug 2019 09:34:53 GMT
adoroszlai commented on a change in pull request #1205: HDDS-1886. Use ArrayList#clear to address
audit failure scenario
URL: https://github.com/apache/hadoop/pull/1205#discussion_r309608143
 
 

 ##########
 File path: hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/audit/TestOzoneAuditLogger.java
 ##########
 @@ -153,7 +153,7 @@ private void verifyLog(String expected) throws IOException {
     assertTrue(lines.size() != 0);
     assertTrue(expected.equalsIgnoreCase(lines.get(0)));
     //empty the file
-    lines.remove(0);
+    lines.clear();
 
 Review comment:
   @dineshchitlangia good idea to avoid unnecessary assumptions.
   
   Here are some further suggestions:
   
   1. Wrap assertions and cleanup in `try` and `finally`, respectively.  Otherwise a failed
assertion would cause all further independent test cases to also fail due to leftover content
in the file.  (This one is not specific to multi-line cases.)
   2. Make `verifyLog` accept `String...` and check each expected line.  Also, retry reading
the file until it has enough lines instead of being non-empty.
   3. I think using `assertEquals` would make it easier to spot differences between expected
and actual values. (I'm not sure case-ignorance is really important.  Currently the test passes
with strict case check, too.)

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message