Skip to content

Commit

Permalink
Add temporary info logs to analyse flaky test issue spring-projects#561
Browse files Browse the repository at this point in the history
  • Loading branch information
KartikShrivastava committed Mar 3, 2024
1 parent 3f17a6c commit 330ed8c
Showing 1 changed file with 10 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,13 @@ 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, one such failure
// case:
// https://github.com/spring-projects/spring-pulsar/actions/runs/7598761030/job/20695067626
for (ReceivedMessage<Foo> message : receivedMessagesWithHeaders) {
logger.info(message.toString());
}
assertMessagesReceivedWithHeaders(receivedMessagesWithHeaders, Foo::new);
assertMessagesReceivedWithoutHeaders(receivedMessagesWithoutHeaders, Foo::new);
}
Expand Down

0 comments on commit 330ed8c

Please sign in to comment.