This is an automated email from the ASF dual-hosted git repository. Croway pushed a commit to branch camel-spring-boot-4.22.x in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
commit 8ff145f52d1ee110e8348fbc1647075f328ce921 Author: croway <[email protected]> AuthorDate: Wed Nov 18 10:19:54 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 572e6d3728b..cdd17b83466 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");
