Skip to content

Commit

Permalink
Add temp logs to help debug flaky test (#597)
Browse files Browse the repository at this point in the history
See #561
  • Loading branch information
KartikShrivastava authored Mar 4, 2024
1 parent 3a837de commit 57fa9e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -226,6 +227,8 @@ Mono<Void> 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);
Expand All @@ -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<Foo> message : receivedMessagesWithHeaders) {
logger.info(message.toString());
}
assertMessagesReceivedWithHeaders(receivedMessagesWithHeaders, Foo::new);
assertMessagesReceivedWithoutHeaders(receivedMessagesWithoutHeaders, Foo::new);
}
Expand Down
3 changes: 3 additions & 0 deletions spring-pulsar-reactive/src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@
</root>
<logger name="org.testcontainers" level="ERROR"/>
<logger name="com.github.dockerjava" level="ERROR"/>
<!-- Temporary logging to analyse CI failures due to flaky test -->
<!-- TODO: Remove once CI failure addressed -->
<logger name="org.springframework.pulsar.reactive.listener.ReactivePulsarListenerTombstoneTests$SingleComplexPayload" level="INFO"/>
</configuration>

0 comments on commit 57fa9e2

Please sign in to comment.