virajjasani commented on PR #5451:
URL: https://github.com/apache/hadoop/pull/5451#issuecomment-1455216823

   > But should change the other test as well to use this, rather than the file 
logic, that if someone copies that for a new test or so, he doesn’t leads us to 
a mess
   
   I still feel that we should have at least one test that directly checks from 
file i.e. primary appender. But I understand your concern of anyone copying the 
entire test.
   
   How about we provide this comment?
   ```
   --- 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestAuditLogs.java
   +++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestAuditLogs.java
   @@ -66,6 +66,14 @@ public class TestAuditLogs {
    
      private static final org.slf4j.Logger LOG = 
LoggerFactory.getLogger(TestAuditLogs.class);
    
   +  /**
   +   * Only this test should directly use file for reading the audit logs 
output. Other tests
   +   * can use {@link org.apache.hadoop.test.GenericTestUtils.LogCapturer} so 
that their output
   +   * stays restricted to the test itself.
   +   * Using the file based reading is fine, but updating the file could lead 
to inconsistent reads
   +   * for other tests. Instead, use LogCapturer to capture only test 
specific audit logs directly
   +   * as LogCapturer uses new appender to get the output for the caller.
   +   */
      private static final File AUDIT_LOG_FILE =
          new File(System.getProperty("hadoop.log.dir"), "hdfs-audit.log");
   
   ```


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to