Skip to content

CAMEL-24035: Fix flaky camel-core tests with timed mock assertions - #25332

Merged
davsclaus merged 2 commits into
apache:mainfrom
atiaomar1978-hub:cursor/CAMEL-24035-flaky-core-tests-c587
Aug 5, 2026
Merged

CAMEL-24035: Fix flaky camel-core tests with timed mock assertions#25332
davsclaus merged 2 commits into
apache:mainfrom
atiaomar1978-hub:cursor/CAMEL-24035-flaky-core-tests-c587

Conversation

@atiaomar1978-hub

@atiaomar1978-hub atiaomar1978-hub commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes CAMEL-24035: flaky camel-core tests 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 — extract TIMEOUT_SECONDS constant for second-phase timed assertions; drop public modifier; keep bare mock.assertIsSatisfied() for count-0 first phase (timed assert adds no value there)
  • ThrottlingExceptionRoutePolicyOpenViaConfigTest — extract TIMEOUT_SECONDS constant; drop public modifier; keep 10s Awaitility for consumer suspend/resume waits

TwoSchedulerTest unchanged — already fixed in CAMEL-24037.

Test plan

  • ./mvnw -pl core/camel-core -am test -Dtest=TwoSchedulerTest,DistributedTimeoutTest,ThrottlingExceptionRoutePolicyOpenViaConfigTest

AI-generated PR description on behalf of atiaomar1978-hub

cursoragent and others added 2 commits August 5, 2026 02:55
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>
@atiaomar1978-hub

Copy link
Copy Markdown
Contributor Author

Fix summary

Addresses CAMEL-24035.

Context: Core flaky-test fixes were already merged in CAMEL-24037 (#24635):

  • TwoSchedulerTest — timed mock assert + assertEquals for thread names
  • DistributedTimeoutTest — removed Awaitility-wrapped mock asserts
  • ThrottlingExceptionRoutePolicyOpenViaConfigTest — timed mock asserts

This PR adds remaining polish on 2 files (14 lines changed):

  • TIMEOUT_SECONDS constant for timed MockEndpoint.assertIsSatisfied calls
  • Drop unnecessary public on test classes/methods
  • Keep bare mock.assertIsSatisfied() for count-0 expectations (timed variant adds no wait)
  • Keep 10s Awaitility for non-mock conditions (consumer suspend/resume, aggregation timeout callback)

Verified:

./mvnw -pl core/camel-core -am test -Dtest=TwoSchedulerTest,DistributedTimeoutTest,ThrottlingExceptionRoutePolicyOpenViaConfigTest

AI-generated comment on behalf of atiaomar1978-hub

@atiaomar1978-hub

Copy link
Copy Markdown
Contributor Author

Review follow-up (BugBot + Grok)

Reviewer Result
BugBot Flagged unrelated TUI changes on fork main — this branch only touches 2 test files
Grok Noted overlap with CAMEL-24037; advised against inflating Awaitility to 30s and ineffective timed assert on count-0 mocks

Applied in commit 045ffb4:

  • Reverted TwoSchedulerTest (no delta vs main)
  • Restored bare mock.assertIsSatisfied() for count-0 phase in DistributedTimeoutTest
  • Restored 10s Awaitility for consumer suspend/resume waits
  • Kept TIMEOUT_SECONDS constant + package-private test classes

AI-generated comment on behalf of atiaomar1978-hub

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions github-actions Bot added the core label Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • core/camel-core

🔬 Scalpel shadow comparison — Scalpel: 24 tested, 0 compile-only — current: 0 all tested

Maveniverse Scalpel detected 24 affected modules (current approach: 0).

⚠️ Modules only in Scalpel (24)
  • camel-console
  • camel-core
  • camel-csimple-joor
  • camel-datasonnet
  • camel-groovy
  • camel-hl7
  • camel-jactl
  • camel-javascript
  • camel-joor
  • camel-jq
  • camel-jsonpath
  • camel-main
  • camel-management
  • camel-mvel
  • camel-ognl
  • camel-platform-http-jolokia
  • camel-python
  • camel-saxon
  • camel-spring-xml
  • camel-stax
  • camel-xml-io-dsl
  • camel-xml-jaxb-dsl
  • camel-xml-jaxb-dsl-test-definition
  • camel-xml-jaxb-dsl-test-spring

Skip-tests mode would test 24 modules (1 direct + 23 downstream), skip tests for 0 (generated code, meta-modules)

Modules Scalpel would test (24)
  • camel-console
  • camel-core
  • camel-csimple-joor
  • camel-datasonnet
  • camel-groovy
  • camel-hl7
  • camel-jactl
  • camel-javascript
  • camel-joor
  • camel-jq
  • camel-jsonpath
  • camel-main
  • camel-management
  • camel-mvel
  • camel-ognl
  • camel-platform-http-jolokia
  • camel-python
  • camel-saxon
  • camel-spring-xml
  • camel-stax
  • camel-xml-io-dsl
  • camel-xml-jaxb-dsl
  • camel-xml-jaxb-dsl-test-definition
  • camel-xml-jaxb-dsl-test-spring

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • core/camel-core: 2 test(s) disabled on GitHub Actions
All tested modules (24 modules)
  • Camel :: Console
  • Camel :: Core
  • Camel :: DataSonnet
  • Camel :: Groovy
  • Camel :: HL7
  • Camel :: JQ
  • Camel :: JSon Path
  • Camel :: Jactl
  • Camel :: JavaScript
  • Camel :: MVEL
  • Camel :: Main
  • Camel :: Management
  • Camel :: OGNL (deprecated)
  • Camel :: Platform HTTP :: Jolokia
  • Camel :: Python
  • Camel :: Saxon
  • Camel :: Spring XML
  • Camel :: StAX
  • Camel :: XML DSL Jaxb :: Test :: Definition
  • Camel :: XML DSL Jaxb :: Test :: Spring
  • Camel :: XML DSL with camel-xml-io
  • Camel :: XML DSL with camel-xml-jaxb
  • Camel :: csimple jOOR (deprecated)
  • Camel :: jOOR

⚙️ View full build and test results

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, bare mock.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) that MockEndpoint cannot express natively. No wrapping of MockEndpoint.assertIsSatisfied() with Awaitility.
  • The public removal is safe: neither test class is extended from another package (verified).
  • TIMEOUT_SECONDS constant type (long) matches the MockEndpoint.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

@davsclaus davsclaus added the test label Aug 5, 2026
@davsclaus
davsclaus merged commit 72a2aa1 into apache:main Aug 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants