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

   ## What changes were proposed in this pull request?
   
   `TestSecureOzoneCluster` had accumulated many near-duplicate @Test methods, 
each spinning up its own MiniKDC, SCM, and OM and repeating identical 
secure-config setup. This made the suite slow (redundant cluster lifecycles) 
and hard to maintain, and setup/teardown logic was copy-pasted per test. 
Several tests also used loose try { ... } catch blocks that would   
     silently pass if the expected exception never fired.
   
   ### Approach 
   Refactor only — no production code and no behavioral test coverage is 
dropped:
   
   - Shared KDC/config setup. MiniKDC, keytabs, principals, and secure config 
move from per-test `@BeforeEach`/`@AfterEach` into static 
`@BeforeAll`/`@AfterAll`; each test derives its conf from a shared kdcConf, so 
the KDC starts once per class instead of once per test.                         
                                                      
     - Merge overlapping tests. Related cases are consolidated into single 
tests that reuse one cluster:                                                   
                   
       - `testSecureScmStartupSuccess` + `testSCMSecurityProtocol` + 
`testAdminAccessControlException` → `testSecureScmStartupAndAccessControl`      
                                 
       - `testSecureOMInitializationFailure` + 
`testSecureOMDelegationTokenSecretManagerInitializationFailure` + 
`testSecureOmInitializationSuccess` + `testSecureOmReInit` → 
`testSecureOMInitialization` (Case 1–4)                                         
                                                                                
           
     - Relocate delegation-token failure coverage. The renewal-failure cases 
move to `TestDelegationToken.testDelegationTokenRenewalFailures`, next to the 
happy-path           
     `testDelegationToken`, removing the duplicated happy-path from 
`TestSecureOzoneCluster`.                                                       
                              
     - Tighten assertions. Loose try/catch blocks become explicit assertThrows, 
and OM shutdown is unified behind a guarded stopOm() helper.                    
              
       
   
   Original test time
   
   ```
   [INFO] Running org.apache.hadoop.ozone.TestSecureOzoneCluster
   [INFO] Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 
208.652 s - in org.apache.hadoop.ozone.TestSecureOzoneCluster
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testSCMSecurityProtocol  Time 
elapsed: 19.2 s
   [INFO] org.apache.hadoop.ozone.TestSecureOzoneCluster.testSecureOmReInit  
Time elapsed: 19.859 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testDelegationTokenRenewCrossSecretKeyRotation
  Time elapsed: 15.421 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testCertificateRotationUnRecoverableFailure
  Time elapsed: 2.802 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testCertificateRotation  Time 
elapsed: 24.522 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testSecureOmInitSuccess  Time 
elapsed: 15.454 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testSecureOmInitializationSuccess
  Time elapsed: 8.88 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testAccessControlExceptionOnClient
  Time elapsed: 22.42 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testSecureScmStartupSuccess  
Time elapsed: 8.825 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testCertificateRotationRecoverableFailure
  Time elapsed: 24.184 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testSecureOMInitializationFailure
  Time elapsed: 8.902 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testDelegationTokenRenewal  Time 
elapsed: 21.312 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testSecureScmStartupFailure  
Time elapsed: 7.731 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testAdminAccessControlException  
Time elapsed: 9.05 s
   
   ```
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-12250 
   
   ## How was this patch tested?
   
   Tested locally using the following command:
   
   ```
   mvn -pl :ozone-integration-test test \
   -Dtest=TestSecureOzoneCluster \
   -Dsurefire.reportFormat=plain \
   -Dsurefire.useFile=false \
   -DskipShade -DskipRecon
   ```
   
   Results:
   - All tests passed
   - Reduced execution time from 208.652s to 162.8s
   
   ```
   [INFO] Running org.apache.hadoop.ozone.TestSecureOzoneCluster
   [INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 
162.8 s -- in org.apache.hadoop.ozone.TestSecureOzoneCluster
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testDelegationTokenRenewCrossSecretKeyRotation
 -- Time elapsed: 18.73 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testGetSetRevokeS3Secret -- Time 
elapsed: 20.96 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testSecureScmStartupAndAccessControl
 -- Time elapsed: 14.20 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testSecureOmGetsScmSignedCertificate
 -- Time elapsed: 14.59 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testCertificateRotationUnRecoverableFailure
 -- Time elapsed: 1.711 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testCertificateRotation -- Time 
elapsed: 20.77 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testAccessControlExceptionOnClient
 -- Time elapsed: 22.22 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testSecureOMInitialization -- 
Time elapsed: 17.53 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testCertificateRotationRecoverableFailure
 -- Time elapsed: 24.30 s
   [INFO] 
org.apache.hadoop.ozone.TestSecureOzoneCluster.testSecureScmStartupFailure -- 
Time elapsed: 6.514 s
   [INFO] 
   [INFO] Results:
   [INFO] 
   [INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0
   [INFO] 
   [INFO] 
------------------------------------------------------------------------
   [INFO] BUILD SUCCESS
   [INFO] 
------------------------------------------------------------------------
   [INFO] Total time:  02:50 min
   [INFO] Finished at: 2026-07-22T09:16:48+09:00
   [INFO] 
------------------------------------------------------------------------
   [INFO] 13 goals, 13 executed
   ```


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