[ 
https://issues.apache.org/jira/browse/HDDS-17142?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrey Yarovoy updated HDDS-17142:
----------------------------------
    Priority: Minor  (was: Major)

> Tests write audit.log and system_audit.log into the module directory instead 
> of target
> --------------------------------------------------------------------------------------
>
>                 Key: HDDS-17142
>                 URL: https://issues.apache.org/jira/browse/HDDS-17142
>             Project: Apache Ozone
>          Issue Type: Bug
>          Components: test
>            Reporter: Andrey Yarovoy
>            Assignee: Andrey Yarovoy
>            Priority: Minor
>
> h3. Problem
> Tests that enable audit logging load a test \{{auditlog.properties}} whose 
> file appenders use relative paths:
> {code}
> appender.audit.fileName=audit.log
> appender.systemaudit.fileName=system_audit.log
> {code}
> Surefire runs tests with the module directory as the working directory, so 
> the files are created in the source
> tree, e.g. \{{hadoop-ozone/integration-test/audit.log}}, not under 
> \{{target/}}. As a result:
> * After running the integration tests locally, \{{rat.sh}} reports both files 
> as unapproved (no license header):
> {code}
> ./hadoop-ozone/integration-test/target/rat.txt: !????? 
> .../hadoop-ozone/integration-test/system_audit.log
> ./hadoop-ozone/integration-test/target/rat.txt: !????? 
> .../hadoop-ozone/integration-test/audit.log
> {code}
> * \{{mvn clean}} does not remove them, and they are not git-ignored, so they 
> show up as untracked files.
> * The files keep growing across runs. The readers search the whole file for a 
> string, so a test that does not
> delete or truncate the file first can match an entry written by an earlier 
> run.
> h3. Where the paths are defined
> Writers (\{{src/test/resources/auditlog.properties}}):
> * \{{hadoop-hdds/framework}}: \{{audit.log}}
> * \{{hadoop-hdds/rocks-native}}: \{{audit.log}}
> * \{{hadoop-ozone/integration-test}}: \{{audit.log}}, \{{system_audit.log}}
> * \{{hadoop-ozone/s3gateway}}: \{{audit.log}}
> Readers, all with the same relative names:
> * \{{AuditLogTestUtils}} (framework test jar): \{{AUDITLOG_FILENAME}}, 
> \{{SYSTEM_AUDITLOG_FILENAME}}; used by
> {\{OzoneRpcClientTests}}, \{{TestOmAcls}}, \{{TestOMRatisSnapshotTransfer}}
> * \{{new File("audit.log")}} in \{{TestOzoneAuditLogger}}, 
> \{{TestOzoneRpcClientForAclAuditLog}},
> {\{TestOzoneTenantShell}}, \{{TestS3GatewayAuditLog}}
> h3. Proposed fix
> Write the audit logs under \{{target/}} and read them from one place:
> * Change every appender \{{fileName}} above to \{{target/audit.log}} / 
> \{{target/system_audit.log}}.
> * Make \{{AuditLogTestUtils}} the single source of the paths (for example 
> public constants or \{{getAuditLogFile()}}),
> and replace the direct \{{new File("audit.log")}} reads with it.
> h3. Testing
> * Run the audit tests listed above; they pass with the logs under 
> \{{target/}}.
> * After running them, no \{{audit.log}} / \{{system_audit.log}} exists in any 
> module directory, and \{{rat.sh}} passes.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to