Croway opened a new pull request, #2110:
URL: https://github.com/apache/camel-spring-boot/pull/2110

   ## Summary
   
   Fixes two independent sources of flakiness in 
`KafkaConsumerFullIT.kafkaMessageIsConsumedByCamel`. This is the 4.18.x 
counterpart of #2109. The 4.22.x Daily #67 failed on it with `mock://result 
Received message count. Expected: <5> but was: <0>`, and 4.18.x has the same 
test code.
   
   ### 1. Topic deletion races the next test
   
   This backports the `KafkaConsumerFullIT` part of #2031 (6826529ca36 on 
`main`). It keeps the `junit5` imports used on this branch, and leaves out 
`KafkaShareConsumerIT`, which does not exist on 4.18.x.
   
   All tests in the class shared the `test-full` topic. The `@AfterEach` fired 
`kafkaAdminClient.deleteTopics(...).all()` without waiting on the future, so 
the topic could still be in the middle of deletion when the next test produced 
its records.
   
   - `@AfterEach` waits up to 60s for the topic deletion to complete.
   - Each run gets a unique topic name and route ID, as in the apache/camel 
CAMEL-19358 fix.
   - `MockEndpoint.assertIsSatisfied(30, TimeUnit.SECONDS, to)` is used where 
messages are expected. `to.assertIsSatisfied(3000)` only applies its timeout to 
endpoints expecting zero messages, so it waited the default 10s.
   
   ### 2. The first-poll assertion
   
   After the mock is satisfied, the test asserted that 
`MockConsumerInterceptor.recordsCaptured.get(0)` held all 5 records. The 
consumer can fetch them in more than one poll. With only the first commit, this 
failed 3 times in 6 local executions with `expected: <5> but was: <3>`. The 
second commit counts the records across all captured batches, which 
apache/camel did in CAMEL-17845 (apache/camel@2e97841cd5e9).
   
   On this branch the starter runs the IT in two failsafe executions, `kafka-3` 
and `integration-test`, so each build runs the test twice.
   
   ### Testing
   
   `KafkaConsumerFullIT` locally against the Kafka testcontainer 
(`-Dci.env.name=apache.org -Dit.test=KafkaConsumerFullIT`), with both commits: 
3 runs, 6 executions (two per build), all green. With only the first commit, 3 
of 6 executions failed on the first-poll assertion.
   
   _Claude Code (Claude Opus 5.5) on behalf of Federico Mariani_
   


-- 
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