cychiu8 opened a new pull request, #10840:
URL: https://github.com/apache/ozone/pull/10840

   ## What changes were proposed in this pull request?
   
   [HDDS-8046](https://issues.apache.org/jira/browse/HDDS-8046) removed some 
unnecessary newlines embedded in default config values in ozone-default.xml. 
[Ayush 
Saxena](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ayushtkn) 
had a great suggestion for avoiding these in the future:
   
   > I thought of adding a test, which checks for all the configs - set of 
configs added into the exception list and warns like don't add such breaks 
unnecessarily, if it is important and legitimate then add it into the exception 
list, that way even the reviewer would be aware that this practice isn't 
encouraged.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-8082
   
   ## How was this patch tested?
   
   Test locally with the following command:
   ```
   mvn -pl :ozone-integration-test test \
   -Dtest='TestOzoneConfigurationFields#testXmlValuesHaveNoEmbeddedNewlines' \
   -DskipShade -DskipRecon
   ```
   
   Testing three scenarios:
   1. Modify a value to include a newline: should fail
   2. Add a test property with an intentional newline in its value: should pass
   3. Validate the current ozone-default.xml: should pass
   
   Detailed results for case 1 (Modify a value to include a newline: should 
fail)
   ```
   [INFO] Running org.apache.hadoop.ozone.TestOzoneConfigurationFields
   [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 
0.236 s <<< FAILURE! -- in org.apache.hadoop.ozone.TestOzoneConfigurationFields
   [ERROR] 
org.apache.hadoop.ozone.TestOzoneConfigurationFields.testXmlValuesHaveNoEmbeddedNewlines
 -- Time elapsed: 0.163 s <<< FAILURE!
   org.opentest4j.AssertionFailedError: These properties in ozone-default.xml 
have an embedded line break in their <value>, which corrupts the runtime 
string:  [ozone.client.key.latest.version.location] Put the value on a single 
line. If the newline is genuinely required, add the property to 
xmlPropsAllowedToContainNewline (in initializeMemberVariables) with a reason + 
Jira. See HDDS-8082. ==> expected: <true> but was: <false>
           at 
org.apache.hadoop.conf.ConfigurationFieldsTests.testXmlValuesHaveNoEmbeddedNewlines(ConfigurationFieldsTests.java:700)
           at java.base/java.lang.reflect.Method.invoke(Method.java:580)
           at 
java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
           at 
java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
           at 
java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
           at 
java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
           at 
java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
   
   [INFO] 
   [INFO] Results:
   [INFO] 
   [ERROR] Failures: 
   [ERROR]   
TestOzoneConfigurationFields>ConfigurationFieldsTests.testXmlValuesHaveNoEmbeddedNewlines:700
 These properties in ozone-default.xml have an embedded line break in their 
<value>, which corrupts the runtime string:  
[ozone.client.key.latest.version.location] Put the value on a single line. If 
the newline is genuinely required, add the property to 
xmlPropsAllowedToContainNewline (in initializeMemberVariables) with a reason + 
Jira. See HDDS-8082. ==> expected: <true> but was: <false>                      
                                                                                
                                                                                
                       
   [INFO] 
   [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
   [INFO] 
   [INFO] 
------------------------------------------------------------------------
   [INFO] BUILD FAILURE
   [INFO] 
------------------------------------------------------------------------
   [INFO] Total time:  11.897 s
   [INFO] Finished at: 2026-07-22T17:11:09+09:00
   ```
   Detailed results for case 2(Add a test property with an intentional newline 
in its value: should pass)
   log:
   ```
   2026-07-22 19:42:58,104 [main] INFO  conf.ConfigurationFieldsTests 
(ConfigurationFieldsTests.java:testXmlValuesHaveNoEmbeddedNewlines(696)) - XML 
Property: ozone.client.key.latest.version.location AllowedToContainNewline
   ```
   ```
   [INFO] Running org.apache.hadoop.ozone.TestOzoneConfigurationFields
   [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.191 
s -- in org.apache.hadoop.ozone.TestOzoneConfigurationFields
   [INFO] 
   [INFO] Results:
   [INFO] 
   [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
   [INFO] 
   [INFO] 
------------------------------------------------------------------------
   [INFO] BUILD SUCCESS
   [INFO] 
------------------------------------------------------------------------
   [INFO] Total time:  10.258 s
   [INFO] Finished at: 2026-07-22T19:49:01+09:00
   [INFO] 
------------------------------------------------------------------------
   ```
   
   Detailed results for case 3(Validate the current ozone-default.xml: should 
pass)
   ```
   [INFO] Running org.apache.hadoop.ozone.TestOzoneConfigurationFields
   [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.158 
s -- in org.apache.hadoop.ozone.TestOzoneConfigurationFields
   [INFO] 
   [INFO] Results:
   [INFO] 
   [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
   [INFO] 
   [INFO] 
------------------------------------------------------------------------
   [INFO] BUILD SUCCESS
   [INFO] 
------------------------------------------------------------------------
   ```


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