You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2026/07/02 11:28:00 UTC

[jira] [Updated] (CAMEL-23880) camel-pulsar - Fix flaky integration tests caused by topic name collisions and resource leaks

     [ https://issues.apache.org/jira/browse/CAMEL-23880?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-23880:
--------------------------------
    Issue Type: Test  (was: Improvement)

> camel-pulsar - Fix flaky integration tests caused by topic name collisions and resource leaks
> ---------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-23880
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23880
>             Project: Camel
>          Issue Type: Test
>          Components: camel-pulsar
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>            Priority: Major
>              Labels: test-flaky
>
> Several camel-pulsar integration tests are flaky, causing spurious CI failures on unrelated PRs.
> The primary root causes are:
> 1. *Topic name collisions*: PulsarConsumerNoAcknowledgementIT and PulsarConsumerReadCompactedIT share the same topic URI (persistent://public/default/camel-topic) with the same subscription name. Since all integration tests share a singleton Pulsar container, messages and subscription state leak between tests, causing non-deterministic message counts.
> 2. *Cross-method contamination*: PulsarConsumerNoAcknowledgementIT has two test methods sharing the same @EndpointInject endpoint (same topic and subscription). Unacknowledged messages from the first test method leak into the second.
> 3. *Resource leaks*: PulsarClient instances created with givenPulsarClient() are never closed, leaking threads and network resources.
> 4. *Exact message count assertions*: Tests use expectedMessageCount(N) instead of expectedMinimumMessageCount(N) for redelivery-based tests where the exact count is timing-dependent.
> 5. *Guava sleep in ReadCompactedIT*: Uninterruptibles.sleepUninterruptibly used instead of Awaitility for waiting on compaction status.
> The fix:
> - Give each test class and test method a unique topic name to prevent cross-contamination
> - Replace @EndpointInject for consumer endpoints with programmatic endpoint creation in @BeforeEach
> - Add proper @AfterEach cleanup to close endpoints, producers, and routes
> - Change expectedMessageCount to expectedMinimumMessageCount for timing-dependent assertions
> - Replace Guava Uninterruptibles.sleepUninterruptibly with Awaitility



--
This message was sent by Atlassian Jira
(v8.20.10#820010)