This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch CAMEL-22110 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 953e1f6caa0e594a8f91c232fcf25075f6906974 Author: Guillaume Nodet <[email protected]> AuthorDate: Thu Mar 19 09:42:36 2026 +0100 CAMEL-22110: Fix flaky HazelcastQueueConsumerPollTest The mock queue.poll() returned "foo" on every call, so the consumer kept sending messages to mock:result (67 instead of expected 1). Fix by returning "foo" only once then null for subsequent calls. Also re-enable the test on CI by removing @DisabledIfSystemProperty. Co-Authored-By: Claude Opus 4.6 <[email protected]> --- .../camel/component/hazelcast/HazelcastQueueConsumerPollTest.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastQueueConsumerPollTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastQueueConsumerPollTest.java index 5d8c7d77a3a6..34de00ce0911 100644 --- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastQueueConsumerPollTest.java +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastQueueConsumerPollTest.java @@ -24,7 +24,6 @@ import com.hazelcast.core.HazelcastInstance; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledIfSystemProperty; import org.mockito.Mock; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,7 +34,6 @@ import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -@DisabledIfSystemProperty(named = "ci.env.name", matches = ".*", disabledReason = "Flaky on GitHub Actions") public class HazelcastQueueConsumerPollTest extends HazelcastCamelTestSupport { private static final Logger LOG = LoggerFactory.getLogger(HazelcastQueueConsumerPollTest.class); @@ -59,7 +57,7 @@ public class HazelcastQueueConsumerPollTest extends HazelcastCamelTestSupport { @Test public void add() throws InterruptedException { - when(queue.poll(10000, TimeUnit.MILLISECONDS)).thenReturn("foo"); + when(queue.poll(10000, TimeUnit.MILLISECONDS)).thenReturn("foo").thenReturn(null); MockEndpoint out = getMockEndpoint("mock:result"); out.expectedMessageCount(1);
