CAMEL-24024: Harden InOutQueueProducerAsyncLoadTest against CI flakes - #25333
Conversation
Poll until inflight repository is drained instead of asserting immediately after executor shutdown. Track JMS listener failures with AtomicInteger instead of fail() from the callback thread. Use try/finally for executor shutdown and drop unnecessary public modifiers. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Fix summaryAddresses CAMEL-24024 — flaky Context: Core fix (500 msgs, Changes:
Verified: ./mvnw -pl components/camel-sjms -am test -Dtest=InOutQueueProducerAsyncLoadTestAI-generated comment on behalf of atiaomar1978-hub |
Count assertion failures from worker threads and avoid masking the primary test failure when executor shutdown times out in finally. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Review follow-up (BugBot + Grok)
Re-verified: AI-generated comment on behalf of atiaomar1978-hub |
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 1 tested, 0 compile-only — current: 11 all testedMaveniverse Scalpel detected 1 affected modules (current approach: 11). Modules only in current approach (10)
Skip-tests mode would test 1 modules (1 direct + 0 downstream), skip tests for 0 (generated code, meta-modules) Modules Scalpel would test (1)
All tested modules (11 modules)
|
gnodet
left a comment
There was a problem hiding this comment.
Well-crafted test-hardening PR that correctly addresses multiple real flakiness sources. Each change targets a genuine race condition or failure-masking pattern:
- Replacing
fail()in the JMSonMessagelistener withAtomicIntegererror tracking is the right fix —fail()from a non-test thread throwsAssertionErrorwhich the JMS infrastructure silently swallows, so the test thread never sees the failure. - Placing
executor.awaitTerminationoutside thefinallyblock avoids masking the real root cause if primary assertions fail. - Awaitility usage for the inflight repository poll follows project conventions correctly (explicit
atMost,untilAsserted, not wrapping MockEndpoint). - Constants extraction improves readability.
- JUnit 5 visibility conventions followed correctly.
One minor nit posted inline (not blocking).
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of @gnodet
| String response = template.requestBody("direct:start", requestText, String.class); | ||
| assertNotNull(response); | ||
| assertEquals(responseText, response); | ||
| } catch (Throwable e) { |
There was a problem hiding this comment.
[Low — style] catch (Throwable e) is slightly broader than necessary. Since the intent is to catch both Exception (from requestBody) and AssertionError (from assertNotNull/assertEquals), using a multi-catch would be more precise:
| } catch (Throwable e) { | |
| } catch (Exception | AssertionError e) { |
Functionally equivalent here since the error is tracked via failures, so not blocking — just a minor precision improvement.
Summary
Fixes CAMEL-24024:
InOutQueueProducerAsyncLoadTestis flaky in CI under load.The core fix (500 messages,
CountDownLatch,AtomicIntegerfailure tracking) was merged as CAMEL-24027 in #24626. This PR addresses remaining flake sources:context.getInflightRepository().size()is 0 instead of asserting immediately after executor shutdownfail()inonMessagewithAtomicIntegererror trackingThrowableso assertion failures in async workers increment the failure countertry/finallyfor shutdown; termination assert outsidefinallyto avoid masking primary failuresMessageProducer.close()when no message was processedpublicmodifiers per JUnit 5 conventionsTest plan
./mvnw -pl components/camel-sjms -am test -Dtest=InOutQueueProducerAsyncLoadTestAI-generated PR description on behalf of atiaomar1978-hub