CAMEL-24035: Fix flaky camel-core tests with timed mock assertions - #25332
Conversation
Complete remaining timed MockEndpoint assertions in DistributedTimeoutTest, standardize 30-second timeouts across all three tests, and drop unnecessary public modifiers from test classes. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Revert TwoSchedulerTest (already fixed in CAMEL-24037). Keep bare assertIsSatisfied for count-0 mocks in DistributedTimeoutTest first phase. Retain 10s Awaitility for non-mock waits; use TIMEOUT_SECONDS constant only for timed MockEndpoint assertions. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Fix summaryAddresses CAMEL-24035. Context: Core flaky-test fixes were already merged in CAMEL-24037 (#24635):
This PR adds remaining polish on 2 files (14 lines changed):
Verified: ./mvnw -pl core/camel-core -am test -Dtest=TwoSchedulerTest,DistributedTimeoutTest,ThrottlingExceptionRoutePolicyOpenViaConfigTestAI-generated comment on behalf of atiaomar1978-hub |
Review follow-up (BugBot + Grok)
Applied in commit
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: 24 tested, 0 compile-only — current: 0 all testedMaveniverse Scalpel detected 24 affected modules (current approach: 0).
|
gnodet
left a comment
There was a problem hiding this comment.
Clean, minimal PR that applies two project conventions — extract timeout magic number to constant and drop public from JUnit 5 test classes/methods — to two files already fixed for the core flakiness issue.
Observations:
- MockEndpoint assertions are used correctly per project rules:
MockEndpoint.assertIsSatisfied(context, TIMEOUT_SECONDS, SECONDS)for timed waits, baremock.assertIsSatisfied()for count-0 expectations (since the latch-based wait adds no value when expected count is zero). - Awaitility is appropriately reserved for non-mock conditions (
invoked.get() == 1,consumer::isSuspended,consumer::isStarted) thatMockEndpointcannot express natively. No wrapping ofMockEndpoint.assertIsSatisfied()with Awaitility. - The
publicremoval is safe: neither test class is extended from another package (verified). TIMEOUT_SECONDSconstant type (long) matches theMockEndpoint.assertIsSatisfied(CamelContext, long, TimeUnit)signature.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of @gnodet
Summary
Fixes CAMEL-24035: flaky
camel-coretests due to timing issues in mock assertions.Note: The core fixes for all three tests were already merged via CAMEL-24037 (#24635) and CAMEL-24042 (#24650). This PR completes the remaining polish:
DistributedTimeoutTest— extractTIMEOUT_SECONDSconstant for second-phase timed assertions; droppublicmodifier; keep baremock.assertIsSatisfied()for count-0 first phase (timed assert adds no value there)ThrottlingExceptionRoutePolicyOpenViaConfigTest— extractTIMEOUT_SECONDSconstant; droppublicmodifier; keep 10s Awaitility for consumer suspend/resume waitsTwoSchedulerTestunchanged — already fixed in CAMEL-24037.Test plan
./mvnw -pl core/camel-core -am test -Dtest=TwoSchedulerTest,DistributedTimeoutTest,ThrottlingExceptionRoutePolicyOpenViaConfigTestAI-generated PR description on behalf of atiaomar1978-hub