From 57fa9e24d86ce8de1e222a392a58c491f7a88e14 Mon Sep 17 00:00:00 2001 From: kash Date: Tue, 5 Mar 2024 02:29:52 +0530 Subject: [PATCH] Add temp logs to help debug flaky test (#597) See #561 --- .../listener/ReactivePulsarListenerTombstoneTests.java | 9 +++++++++ .../src/test/resources/logback-test.xml | 3 +++ 2 files changed, 12 insertions(+) diff --git a/spring-pulsar-reactive/src/test/java/org/springframework/pulsar/reactive/listener/ReactivePulsarListenerTombstoneTests.java b/spring-pulsar-reactive/src/test/java/org/springframework/pulsar/reactive/listener/ReactivePulsarListenerTombstoneTests.java index 780f40f9..80497c9c 100644 --- a/spring-pulsar-reactive/src/test/java/org/springframework/pulsar/reactive/listener/ReactivePulsarListenerTombstoneTests.java +++ b/spring-pulsar-reactive/src/test/java/org/springframework/pulsar/reactive/listener/ReactivePulsarListenerTombstoneTests.java @@ -33,6 +33,7 @@ import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Configuration; +import org.springframework.core.log.LogAccessor; import org.springframework.messaging.Message; import org.springframework.messaging.handler.annotation.Header; import org.springframework.messaging.handler.annotation.Payload; @@ -226,6 +227,8 @@ Mono listenWithoutHeaders(@Payload(required = false) String msg) { @ContextConfiguration(classes = SingleComplexPayloadConfig.class) class SingleComplexPayload { + private final LogAccessor logger = new LogAccessor(this.getClass()); + private static final String TOPIC = "rpltt-single-complex-topic"; static CountDownLatch latchWithHeaders = new CountDownLatch(3); @@ -240,6 +243,12 @@ void shouldReceiveMessagesWithTombstone() throws Exception { sendTestMessages(fooPulsarTemplate, TOPIC, Schema.JSON(Foo.class), Foo::new); assertThat(latchWithHeaders.await(10, TimeUnit.SECONDS)).isTrue(); assertThat(latchWithoutHeaders.await(10, TimeUnit.SECONDS)).isTrue(); + + // Temporary log to analyze CI failures due to flaky test + // TODO: Remove once CI failure addressed + for (ReceivedMessage message : receivedMessagesWithHeaders) { + logger.info(message.toString()); + } assertMessagesReceivedWithHeaders(receivedMessagesWithHeaders, Foo::new); assertMessagesReceivedWithoutHeaders(receivedMessagesWithoutHeaders, Foo::new); } diff --git a/spring-pulsar-reactive/src/test/resources/logback-test.xml b/spring-pulsar-reactive/src/test/resources/logback-test.xml index 554cd1bd..6ad91864 100644 --- a/spring-pulsar-reactive/src/test/resources/logback-test.xml +++ b/spring-pulsar-reactive/src/test/resources/logback-test.xml @@ -9,4 +9,7 @@ + + +