prashantwason commented on PR #18033:
URL: https://github.com/apache/hudi/pull/18033#issuecomment-4029611246

   Fixed the test - the previous version had two bugs:
   
   1. **Mock wasn't calling real methods**: 
`mock(HoodieBackedTableMetadataWriterTableVersionSix.class)` creates a mock 
where all methods return default values (`false` for boolean). So 
`shouldInitializeFromFilesystem` was never actually executed - tests expecting 
`assertFalse` passed for the wrong reason, and tests expecting `assertTrue` 
would have failed. Fixed by using `CALLS_REAL_METHODS`.
   
   2. **Missing `metrics` field**: The `metrics` field was null on the mock, 
which would cause NPE when the real method hits `metrics.ifPresent(...)`. Fixed 
by setting `metrics` to `Option.empty()` via reflection.
   
   3. **Simplified method invocation**: Removed unnecessary reflection-based 
method invocation since the test is in the same package as the class under test 
and can call the package-private method directly.
   
   Note: This test was only run by Azure CI ("UT FT common & other modules" 
job) which was failing with a Docker infrastructure error, masking these test 
issues. GitHub Actions CI runs `hudi-hadoop-mr,hudi-client/hudi-java-client` 
but not `hudi-client/hudi-client-common`.
   
   @hudi-bot run azure


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

Reply via email to