This is an automated email from the ASF dual-hosted git repository.

Croway pushed a commit to branch camel-spring-boot-4.18.x
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git

commit 172a965a21ec5413532730449930aa5678c4abdc
Author: croway <[email protected]>
AuthorDate: Wed Nov 18 10:20:12 2026 +0100

    Fix flaky first-poll assertion in KafkaConsumerFullIT
    
    kafkaMessageIsConsumedByCamel asserted that the first batch captured by
    MockConsumerInterceptor contained all 5 records, but the consumer can
    fetch them across more than one poll ("expected: <5> but was: <3>").
    Count the records across all the captured batches, as apache/camel did
    in CAMEL-17845.
---
 .../camel/component/kafka/integration/KafkaConsumerFullIT.java       | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/components-starter/camel-kafka-starter/src/test/java/org/apache/camel/component/kafka/integration/KafkaConsumerFullIT.java
 
b/components-starter/camel-kafka-starter/src/test/java/org/apache/camel/component/kafka/integration/KafkaConsumerFullIT.java
index cd5ea36beb1..a7f9c90c0ff 100644
--- 
a/components-starter/camel-kafka-starter/src/test/java/org/apache/camel/component/kafka/integration/KafkaConsumerFullIT.java
+++ 
b/components-starter/camel-kafka-starter/src/test/java/org/apache/camel/component/kafka/integration/KafkaConsumerFullIT.java
@@ -122,8 +122,9 @@ public class KafkaConsumerFullIT extends 
BaseEmbeddedKafkaTestSupport {
 
         MockEndpoint.assertIsSatisfied(30, TimeUnit.SECONDS, to);
 
-        assertEquals(5, StreamSupport
-                
.stream(MockConsumerInterceptor.recordsCaptured.get(0).records(TOPIC).spliterator(),
 false).count());
+        // the records may be fetched in more than one poll, so count them 
across all the captured batches
+        assertEquals(5, MockConsumerInterceptor.recordsCaptured.stream()
+                .flatMap(i -> 
StreamSupport.stream(i.records(TOPIC).spliterator(), false)).count());
 
         Map<String, Object> headers = 
to.getExchanges().get(0).getIn().getHeaders();
         assertFalse(headers.containsKey(skippedHeaderKey), "Should not receive 
skipped header");

Reply via email to