HDDS-16482. Fix flaky assertion in TestBlockDataStreamOutput - #11263
Conversation
Verify the root cause of the IOException from close() instead of relying on exception wrapping that varies with thread scheduling.
chihsuan
left a comment
There was a problem hiding this comment.
Thanks @andyhuangdev +1, LGTM.
If you get a chance, could you run the flaky-test-check workflow on your fork and link the run here? That helps confirm it holds on CI too. 🙂
F64116045
left a comment
There was a problem hiding this comment.
Thanks @andyhuangdev.
LGTM.
Just to confirm in the description
The remaining branch contains a no-op assertion; correcting it exposes the intermittent failure.
Was the no-op assertion already fixed in HDDS-16084, with this PR fixing the flakiness exposed by that change?
Ran flaky-test-check on this branch for TestBlockDataStreamOutput#closeAfterWriteFailureThrows with 10 splits × 10 iterations on Java 25. All 100 iterations passed: https://github.com/andyhuangdev/ozone/actions/runs/35450918876 |
Yes, that's correct. HDDS-16084 (#11056) already fixed the no-op assertion. This PR addresses the flakiness exposed by that fix by checking the root cause type and message, while retaining the assertion that close() throws IOException. It also removes the unreachable CompletionException branch. |
Russole
left a comment
There was a problem hiding this comment.
Thanks @andyhuangdev for working on this. LGTM!
|
Thanks @andyhuangdev for the patch, @chihsuan, @F64116045, @Russole for the review. |
What changes were proposed in this pull request?
TestBlockDataStreamOutput.closeAfterWriteFailureThrows checks the injected failure message in the exception thrown by close().
Depending on thread scheduling, the failure is wrapped differently, and the outer exception message may not contain the injected message.
This change verifies the root cause type and message while retaining the assertion that close() throws IOException. It removes the unreachable branch and updates the comment to explain the asynchronous exception wrapping.
What is the link to the Apache JIRA
HDDS-16482
How was this patch tested?
Repeated closeAfterWriteFailureThrows in IntelliJ IDEA using "N times" set to 100 across multiple runs. All runs passed without failures.