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

   ## Summary
   
   Fix flaky `PulsarCustomMessageReceiptIT` by applying the same test isolation 
pattern established in commit 7be7e46fb6bb (CAMEL-23880) for sibling Pulsar ITs.
   
   ## Root Cause
   
   `PulsarCustomMessageReceiptIT` had two root causes for flakiness:
   
   1. **Hardcoded static topic URI** 
(`persistent://public/default/camel-topic-PulsarCustomMessageReceiptIT`) and 
hardcoded producer name (`"camel-producer-1"`). Running with `-T1C` or 
alongside other Pulsar ITs sharing the same singleton Pulsar container caused 
subscription state and producer name conflicts between test runs.
   
   2. **Missing `@AfterEach` cleanup** — no `producer.close()`, no 
`from.close()`, no route removal. Resource leaks between test methods caused 
`ProducerBusyException` on subsequent invocations.
   
   Additionally, `@EndpointInject` on `from` created the consumer endpoint 
bound to the static URI at context startup, before `@BeforeEach` could assign a 
unique topic per invocation.
   
   This test was inadvertently omitted from the fix in commit 7be7e46fb6bb 
(CAMEL-23880), which fixed the same issues in 
`PulsarConsumerNegativeAcknowledgementIT`, `PulsarConsumerNoAcknowledgementIT`, 
and `PulsarConsumerReadCompactedIT`.
   
   ## Fix
   
   Applies the exact same pattern as the CAMEL-23880 siblings:
   
   - Replace static `TOPIC_URI` + `PRODUCER` constants with `TOPIC_URI_PREFIX` 
and a static `topicId` counter, giving each test method a unique Pulsar topic
   - Remove `@EndpointInject` on `from`; create the endpoint programmatically 
in `@BeforeEach` bound to the per-test unique topic URI
   - Randomize the Pulsar producer name via `TestUtils.randomWithRange()` to 
prevent name conflicts
   - Expand `@BeforeEach` to remove the previous route before setup
   - Add `@AfterEach tearDown()` that closes the `from` endpoint and 
`producer`, and removes the route
   
   ## Tests
   
   The existing `testAcknowledgeWithCustomMessageReceipt` test covers the fix — 
the test itself is unchanged; only the setup/teardown infrastructure is fixed 
to make it isolation-safe.
   
   Fixes https://issues.apache.org/jira/browse/CAMEL-25628
   
   ---
   _Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to