unbridled-41 opened a new pull request, #10996:
URL: https://github.com/apache/rocketmq/pull/10996

   ### Which Issue(s) This PR Fixes
   
   - Fixes #10995
   
   ### Brief Description
   
   `DefaultReceiptHandleManagerTest#testClientOffline` triggers asynchronous 
receipt-handle cleanup after `CLIENT_UNREGISTER`.
   
   The test previously did not stub `messagingProcessor.changeInvisibleTime()` 
for the cleanup path. The unstubbed Mockito invocation returns `null`, and the 
asynchronous `ReturnHandleGroupWorkerThread` can then throw a 
`NullPointerException` when the test listener calls `whenComplete()`.
   
   When this happens, the receipt handle is not removed and 
`returnHandleGroup()` may insert the non-empty group back into 
`receiptHandleGroupMap`. Because the test immediately asserted that the map was 
empty after triggering `CLIENT_UNREGISTER`, the assertion was timing-sensitive 
and could fail in Coverage CI.
   
   This change is test-only:
   
   - stub `changeInvisibleTime()` with a completed `CompletableFuture` for the 
cleanup path;
   - use Awaitility to wait for the asynchronous cleanup and verify the 
expected invocation;
   - keep the final map-empty assertion inside the asynchronous wait;
   - do not change production behavior.
   
   ### How Did You Test This Change?
   
   Tested with JDK 8:
   
   - `DefaultReceiptHandleManagerTest#testClientOffline`: 50/50 repeated runs 
passed
   - `DefaultReceiptHandleManagerTest`: 12/12 tests passed
   - proxy module: 308 tests run, 0 failures, 0 errors, 3 skipped
   - Maven result: `BUILD SUCCESS`
   - `git diff --check`: passed
   


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