You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2026/07/06 08:14:41 UTC

[PR] CAMEL-23915: Fix flaky MockEndpointTimeClauseTest [camel]

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

   ## Summary
   
   _Claude Code on behalf of Guillaume Nodet_
   
   Replace all 10 `Thread.sleep(50)` calls in `MockEndpointTimeClauseTest` with Awaitility-based assertions, following the project's testing guidelines that prohibit `Thread.sleep()` in test code.
   
   ### Changes
   - Replace `Thread.sleep(50)` between message sends with `await().atMost(5, TimeUnit.SECONDS).until(() -> mock.getReceivedCounter() >= N)` to wait for message receipt with proper timeout
   - For tests with `between()` timing bounds that require a minimum inter-message gap, use `pollDelay(20, TimeUnit.MILLISECONDS)` to ensure sufficient delay for lower-bound assertions
   - Widen timing assertion upper bounds (`between(10, 500)` → `between(10, 2000)`, `noLaterThan(250).millis()` → `noLaterThan(2).seconds()`) to prevent flakiness on slow CI systems
   - Replace the `Thread.sleep(50)` + try/catch inside the executor thread in `testAssertPeriodSecondMessageArrives` with a direct Awaitility wait for message receipt
   
   ### Why this prevents flakiness
   - `Thread.sleep(50)` is unreliable — on busy CI systems, it may sleep for much longer, causing tight timing assertions to fail
   - Awaitility provides deterministic synchronization: it waits until the mock endpoint has actually received the expected messages, rather than hoping a fixed sleep is sufficient
   - Widened upper bounds accommodate CI environments where GC pauses or thread scheduling delays can cause unexpected timing variations
   
   ## Test plan
   - [x] All 11 tests in `MockEndpointTimeClauseTest` pass locally
   - [x] Verified stability with 3 consecutive runs (0 failures)
   - [x] Code formatted with `mvn formatter:format impsort:sort`
   - [ ] CI passes
   
   JIRA: [CAMEL-23915](https://issues.apache.org/jira/browse/CAMEL-23915)


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-23915: Fix flaky MockEndpointTimeClauseTest [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #24443:
URL: https://github.com/apache/camel/pull/24443#issuecomment-4890577543

   :star2: Thank you for your contribution to the Apache Camel project! :star2:
     :robot: CI automation will test this PR automatically.
   
     :camel: 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](https://camel.apache.org/community/team/#committers) have access to the summary.
     
     :warning: Be careful when sharing logs. Review their contents before sharing them publicly.


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-23915: Fix flaky MockEndpointTimeClauseTest [camel]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #24443:
URL: https://github.com/apache/camel/pull/24443#issuecomment-4890712136

   @copilot review


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-23915: Fix flaky MockEndpointTimeClauseTest [camel]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #24443:
URL: https://github.com/apache/camel/pull/24443


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-23915: Fix flaky MockEndpointTimeClauseTest [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #24443:
URL: https://github.com/apache/camel/pull/24443#issuecomment-4891044860

   <!-- ci-tested-modules -->
   :test_tube: **CI tested the following changed modules:**
   
   - `core/camel-core`
   
   ---
   
   <details><summary>:microscope: Scalpel shadow comparison — Scalpel: 23 tested, 0 compile-only — current: 0 all tested</summary>
   
   [Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **23 affected modules** (current approach: 0).
   
   <details><summary>:warning: Modules only in Scalpel (23)</summary>
   
   - `camel-console`
   - `camel-core`
   - `camel-csimple-joor`
   - `camel-datasonnet`
   - `camel-groovy`
   - `camel-hl7`
   - `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`
   
   </details>
   
   **Skip-tests mode would test 23 modules** (1 direct + 22 downstream), **skip tests for 0** (generated code, meta-modules)
   
   <details><summary>Modules Scalpel would test (23)</summary>
   
   - `camel-console`
   - `camel-core`
   - `camel-csimple-joor`
   - `camel-datasonnet`
   - `camel-groovy`
   - `camel-hl7`
   - `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`
   
   </details>
   
   > :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
   
   </details>
   
   :warning: **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
   
   <details><summary>All tested modules (23 modules)</summary>
   
   - Camel :: Console
   - Camel :: Core
   - Camel :: DataSonnet
   - Camel :: Groovy
   - Camel :: HL7
   - Camel :: JQ
   - Camel :: JSon Path
   - 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
   
   </details>
   
   ---
   :gear: [View full build and test results](https://github.com/apache/camel/actions/runs/28777530684)


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-23915: Fix flaky MockEndpointTimeClauseTest [camel]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #24443:
URL: https://github.com/apache/camel/pull/24443#issuecomment-4891005729

   @copilot review


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org