From e601cdcb5c07fa75c50f78f2ed90a62b6586ec55 Mon Sep 17 00:00:00 2001 From: Soby Chacko Date: Wed, 15 Feb 2023 13:18:03 -0500 Subject: [PATCH] sync send in latestMessageId test - In order to avoid a potential race condition in this test, convert the asyncSend to sync. --- .../reader/DefaultPulsarReaderListenerContainerTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-pulsar/src/test/java/org/springframework/pulsar/reader/DefaultPulsarReaderListenerContainerTests.java b/spring-pulsar/src/test/java/org/springframework/pulsar/reader/DefaultPulsarReaderListenerContainerTests.java index d57f6767..09ecc65e 100644 --- a/spring-pulsar/src/test/java/org/springframework/pulsar/reader/DefaultPulsarReaderListenerContainerTests.java +++ b/spring-pulsar/src/test/java/org/springframework/pulsar/reader/DefaultPulsarReaderListenerContainerTests.java @@ -151,14 +151,14 @@ public class DefaultPulsarReaderListenerContainerTests implements PulsarTestCont // The following sends will not be received by the reader as we are using the // latest message id to start from. for (int i = 0; i < 5; i++) { - pulsarTemplate.sendAsync("This message should not be received by the reader"); + pulsarTemplate.send("This message should not be received by the reader"); } container.start(); assertThat(container.isRunning()).isTrue(); pulsarTemplate.sendAsync("This message should be received by the reader"); pulsarTemplate.sendAsync("This message should be received by the reader"); - assertThat(latch.await(30, TimeUnit.SECONDS)).isTrue(); + assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue(); } finally { safeStopContainer(container);