Jason918 opened a new pull request, #4711: URL: https://github.com/apache/bookkeeper/pull/4711
## Descriptions of the changes in this PR: ### Motivation The unit tests in `BookieSocketAddressTest` were dependent on local system network configuration, particularly the use of loopback addresses (127.0.0.1). This caused inconsistent test behavior across different environments and could lead to test failures when loopback addresses were restricted by system configuration. ### Changes - Added `mockHostnameIPSetup` helper method using Mockito.mockStatic to simulate DNS.getDefaultIP behavior - Modified `testBookieAddressIsIPAddressByDefault` to use mock instead of actual loopback addresses - Modified `testBookieAddressIsHostname` to use mock with resolvable localhost address - Simplified `testAdvertisedWithNonLoopbackAddress` by removing complex local network detection logic - All tests now use consistent mock approach instead of relying on actual network configuration **Key improvements:** - Eliminates dependency on local system network settings - Ensures consistent test behavior across all environments - Improves test reliability and portability - Maintains all existing test assertions and functionality **Verification:** - All 4 existing tests pass with the mock implementation - No regression in test coverage or functionality - Tests are now environment-agnostic -- 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]
