gnodet opened a new pull request, #2946:
URL: https://github.com/apache/cxf/pull/2946

   ## Summary
   
   Fixes three categories of flaky test failures observed in CI:
   
   ### UndertowHTTPServerEngineTest
   - **Root cause**: Port cleanup (`destroyForPort`) was done at the end of 
each test body. If a test failed mid-execution (e.g., assertion failure), ports 
remained bound, causing cascading "Address already in use" failures in 
subsequent tests.
   - **Fix**: Move port cleanup to an `@After` method that always runs, even on 
test failure.
   
   ### JMSDestinationTest (via AbstractJMSTester)
   - **Root cause**: Classic lost-notification race condition in 
`waitForReceiveInMessage()` and `waitForReceiveDestMessage()`. The null check 
was outside the `synchronized` block, so if a message arrived between the check 
and `wait()`, the `notifyAll()` fired before `wait()` started, causing the test 
to block for the full 10-second (or 60-second JMS-level) timeout.
   - **Fix**: Move the null check inside the `synchronized` block.
   
   ### Tracing tests (Brave, Micrometer, OpenTelemetry, OpenTracing)
   - **Root cause 1**: Awaitility timeouts of 1 second were too tight for slow 
CI environments. In `testThatNewSpanIsCreatedOnClientTimeout`, the 
`ConditionTimeoutException` from the `finally` block's await would mask the 
expected `ProcessingException`, causing JUnit's `ExpectedException` rule to 
fail.
   - **Root cause 2**: In `OpenTracingTracingTest`, the static 
`InMemoryReporter` could receive spans from a previous test's asynchronous 
server-side processing after `@After` cleared it but before the next test's 
assertions, causing unexpected span counts.
   - **Fix**: Increase all awaitility timeouts from 1s to 10s (awaitility 
polls, so fast tests still complete quickly). Add `@Before` cleanup to 
`OpenTracingTracingTest` to catch stale spans.
   
   ## Test plan
   - [x] Verify all modified tests still pass locally
   - [ ] CI should show reduced flaky test failures
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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