From 1bda9a57df705f600a4881d6cf6b564282a006d8 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Wed, 10 Jul 2019 16:14:30 +0200 Subject: [PATCH] Trying to make the build less brittle --- .../activemq-data/localhost/KahaDB/db.data | Bin 0 -> 32768 bytes .../activemq-data/localhost/KahaDB/db.redo | Bin 0 -> 32824 bytes .../activemq-data/localhost/KahaDB/lock | Bin 0 -> 8 bytes .../JmsTracingConfigurationTest.java | 15 ++++++-- ...stTemplateTraceAspectIntegrationTests.java | 34 +++++++----------- 5 files changed, 25 insertions(+), 24 deletions(-) create mode 100644 tests/spring-cloud-sleuth-instrumentation-messaging-tests/activemq-data/localhost/KahaDB/db.data create mode 100644 tests/spring-cloud-sleuth-instrumentation-messaging-tests/activemq-data/localhost/KahaDB/db.redo create mode 100644 tests/spring-cloud-sleuth-instrumentation-messaging-tests/activemq-data/localhost/KahaDB/lock diff --git a/tests/spring-cloud-sleuth-instrumentation-messaging-tests/activemq-data/localhost/KahaDB/db.data b/tests/spring-cloud-sleuth-instrumentation-messaging-tests/activemq-data/localhost/KahaDB/db.data new file mode 100644 index 0000000000000000000000000000000000000000..3ba33e62ef9c264769afa6850a9d9271d79b3257 GIT binary patch literal 32768 zcmeI&%TB^T6o6syLgKh~KZbqNl7i=Q#Zbf7Mbw@2uMx- zN#K+j=Je$2qB&{XqWz#Fc~d6RbEVhqdv4$N<;7qa%8u*x#8aH;aJkU;I?Lm99(W>A zc@e%{M}c3hW?J8>vCacmEUGw+-*w=-y{;G~TFr-(vWU{xc~E4f{!JC6+1ODFHJWHg zjf(h1&z_yUNHgtB)kH;)P88=;XO+)cCBLdl5HnqLYO;n%rkJYz1YBXBr$Ju8!d203$5I_I{1Q0*~ z0R#|0009ILK%kxiw$B%)yznPB8z*jmw!ABKscqf%pT}mRWfu<3!O@o)c7cch0tg_0 z00IagfB*srAb{o#Pf4}~m9RUOoKmY**5I_I{1Q0*~fxi&= E21%8K`Tzg` literal 0 HcmV?d00001 diff --git a/tests/spring-cloud-sleuth-instrumentation-messaging-tests/activemq-data/localhost/KahaDB/db.redo b/tests/spring-cloud-sleuth-instrumentation-messaging-tests/activemq-data/localhost/KahaDB/db.redo new file mode 100644 index 0000000000000000000000000000000000000000..14e640f13fdc66db851ab45f293bd1c8d87709c6 GIT binary patch literal 32824 zcmeI(F%H5Y6aY}#)DG(E=1^~7yn~1EFkaHl#j7Z7KHb@hc}>a(0?F@V>Q6{%d2Vz2 ze4QUT49kp$009C72oNAZfB*pk1PBoLJAppFXek8b{yoNJzU%TtelPF2jb2J)3{Ias zd5Ap%0RjXF5FkK+009C72oNB!X@S1{?_VR$DdIPtO=mAT0t5&UAV7cs0RjXF5FkLH zMqsB7P{U;{0RjXF5FkK+009C72oPvmU{nWa`urqMfB*pk1PBlyK!5-N0t9LVhEfOE z$F3=&djU0!))F8 { @@ -219,6 +222,8 @@ public class JmsTracingConfigurationTest { @EnableJms static class SimpleJmsListenerConfiguration implements JmsListenerConfigurer { + private static final Log log = LogFactory.getLog(AnnotationJmsListenerConfiguration.class); + @Autowired CurrentTraceContext current; @@ -234,6 +239,7 @@ public class JmsTracingConfigurationTest { @Bean MessageListener simpleMessageListener(CurrentTraceContext current) { return message -> { + log.info("Got message"); // Didn't restart the trace assertThat(current.get()).isNotNull() .extracting(TraceContext::parentIdAsLong).isNotEqualTo(0L); @@ -246,11 +252,14 @@ public class JmsTracingConfigurationTest { @EnableJms static class AnnotationJmsListenerConfiguration { + private static final Log log = LogFactory.getLog(AnnotationJmsListenerConfiguration.class); + @Autowired CurrentTraceContext current; @JmsListener(destination = "myQueue") public void onMessage() { + log.info("Got message!"); assertThat(this.current.get()).isNotNull() .extracting(TraceContext::parentIdAsLong).isNotEqualTo(0L); } @@ -303,7 +312,7 @@ public class JmsTracingConfigurationTest { } @Configuration -@EnableAutoConfiguration +@EnableAutoConfiguration(exclude = KafkaAutoConfiguration.class) class JmsTestTracingConfiguration { static final String CONTEXT_LEAK = "context.leak"; diff --git a/tests/spring-cloud-sleuth-instrumentation-mvc-tests/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/RestTemplateTraceAspectIntegrationTests.java b/tests/spring-cloud-sleuth-instrumentation-mvc-tests/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/RestTemplateTraceAspectIntegrationTests.java index 310c3737e..b75303a56 100644 --- a/tests/spring-cloud-sleuth-instrumentation-mvc-tests/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/RestTemplateTraceAspectIntegrationTests.java +++ b/tests/spring-cloud-sleuth-instrumentation-mvc-tests/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/RestTemplateTraceAspectIntegrationTests.java @@ -24,6 +24,7 @@ import java.util.stream.Collectors; import brave.Tracing; import brave.sampler.Sampler; import brave.spring.web.TracingAsyncClientHttpRequestInterceptor; +import org.awaitility.Awaitility; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -33,6 +34,7 @@ import zipkin2.Span; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration; import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; @@ -62,9 +64,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = RestTemplateTraceAspectIntegrationTests.Config.class, - webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - properties = "spring.sleuth.web.client.skipPattern=/issue.*") +@SpringBootTest(classes = RestTemplateTraceAspectIntegrationTests.Config.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = "spring.sleuth.web.client.skipPattern=/issue.*") @DirtiesContext public class RestTemplateTraceAspectIntegrationTests { @@ -113,7 +113,7 @@ public class RestTemplateTraceAspectIntegrationTests { whenARequestIsSentToAnAsyncRestTemplateEndpoint(); thenTraceIdHasBeenSetOnARequestHeader(); - thenClientKindIsReported(); + Awaitility.await().untilAsserted(this::thenClientKindIsReported); } @Test @@ -181,7 +181,7 @@ public class RestTemplateTraceAspectIntegrationTests { .andExpect(status().isOk()); } - @EnableAutoConfiguration + @EnableAutoConfiguration(exclude = TraceWebServletAutoConfiguration.class) @Import(AspectTestingController.class) public static class Config { @@ -231,49 +231,42 @@ public class RestTemplateTraceAspectIntegrationTests { this.traceId = null; } - @RequestMapping(value = "/issue1047_end", method = RequestMethod.GET, - produces = MediaType.TEXT_PLAIN_VALUE) + @RequestMapping(value = "/issue1047_end", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) public String issue1047() { return "should_filter_out_this_endpoint"; } - @RequestMapping(value = "/issue1047_start", method = RequestMethod.GET, - produces = MediaType.TEXT_PLAIN_VALUE) + @RequestMapping(value = "/issue1047_start", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) public String issue1047Start() { return callAndReturnIssue1047(); } - @RequestMapping(value = "/", method = RequestMethod.GET, - produces = MediaType.TEXT_PLAIN_VALUE) + @RequestMapping(value = "/", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) public String home( @RequestHeader(value = "X-B3-SpanId", required = false) String traceId) { this.traceId = traceId == null ? "UNKNOWN" : traceId; return "trace=" + this.getTraceId(); } - @RequestMapping(value = "/customTag", method = RequestMethod.GET, - produces = MediaType.TEXT_PLAIN_VALUE) + @RequestMapping(value = "/customTag", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) public String customTag( @RequestHeader(value = "X-B3-TraceId", required = false) String traceId) { this.traceId = traceId == null ? "UNKNOWN" : traceId; return "trace=" + this.getTraceId(); } - @RequestMapping(value = "/asyncRestTemplate", method = RequestMethod.GET, - produces = MediaType.TEXT_PLAIN_VALUE) + @RequestMapping(value = "/asyncRestTemplate", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) public String asyncRestTemplate() throws ExecutionException, InterruptedException { return callViaAsyncRestTemplateAndReturnOk(); } - @RequestMapping(value = "/syncPing", method = RequestMethod.GET, - produces = MediaType.TEXT_PLAIN_VALUE) + @RequestMapping(value = "/syncPing", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) public String syncPing() { return callAndReturnOk(); } - @RequestMapping(value = "/callablePing", method = RequestMethod.GET, - produces = MediaType.TEXT_PLAIN_VALUE) + @RequestMapping(value = "/callablePing", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) public Callable asyncPing() { return new Callable() { @Override @@ -283,8 +276,7 @@ public class RestTemplateTraceAspectIntegrationTests { }; } - @RequestMapping(value = "/webAsyncTaskPing", method = RequestMethod.GET, - produces = MediaType.TEXT_PLAIN_VALUE) + @RequestMapping(value = "/webAsyncTaskPing", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) public WebAsyncTask webAsyncTaskPing() { return new WebAsyncTask<>(new Callable() { @Override