Bumped libraries
awaitillity to 3.0.0 wiremock to 2.6.0 junit params to 1.1.0 assertj to 3.8.0 fixes #620
This commit is contained in:
10
pom.xml
10
pom.xml
@@ -201,27 +201,27 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jayway.awaitility</groupId>
|
||||
<groupId>org.awaitility</groupId>
|
||||
<artifactId>awaitility</artifactId>
|
||||
<version>1.7.0</version>
|
||||
<version>3.0.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.tomakehurst</groupId>
|
||||
<artifactId>wiremock</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<version>2.6.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pl.pragmatists</groupId>
|
||||
<artifactId>JUnitParams</artifactId>
|
||||
<version>1.0.6</version>
|
||||
<version>1.1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>3.6.2</version>
|
||||
<version>3.8.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jayway.awaitility</groupId>
|
||||
<groupId>org.awaitility</groupId>
|
||||
<artifactId>awaitility</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -52,7 +52,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.jayway.awaitility.Awaitility;
|
||||
import org.awaitility.Awaitility;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
@@ -88,7 +88,7 @@ public class Issue410Tests {
|
||||
"http://localhost:" + port() + "/without_pool", String.class);
|
||||
|
||||
then(response).isEqualTo(span.traceIdString());
|
||||
Awaitility.await().until(() -> {
|
||||
Awaitility.await().untilAsserted(() -> {
|
||||
then(this.asyncTask.getSpan().get()).isNotNull();
|
||||
then(this.asyncTask.getSpan().get().getTraceId())
|
||||
.isEqualTo(span.getTraceId());
|
||||
@@ -108,7 +108,7 @@ public class Issue410Tests {
|
||||
"http://localhost:" + port() + "/with_pool", String.class);
|
||||
|
||||
then(response).isEqualTo(span.traceIdString());
|
||||
Awaitility.await().until(() -> {
|
||||
Awaitility.await().untilAsserted(() -> {
|
||||
then(this.asyncTask.getSpan().get()).isNotNull();
|
||||
then(this.asyncTask.getSpan().get().getTraceId())
|
||||
.isEqualTo(span.getTraceId());
|
||||
@@ -131,7 +131,7 @@ public class Issue410Tests {
|
||||
"http://localhost:" + port() + "/completable", String.class);
|
||||
|
||||
then(response).isEqualTo(span.traceIdString());
|
||||
Awaitility.await().until(() -> {
|
||||
Awaitility.await().untilAsserted(() -> {
|
||||
then(this.asyncTask.getSpan().get()).isNotNull();
|
||||
then(this.asyncTask.getSpan().get().getTraceId())
|
||||
.isEqualTo(span.getTraceId());
|
||||
@@ -154,7 +154,7 @@ public class Issue410Tests {
|
||||
"http://localhost:" + port() + "/taskScheduler", String.class);
|
||||
|
||||
then(response).isEqualTo(span.traceIdString());
|
||||
Awaitility.await().until(() -> {
|
||||
Awaitility.await().untilAsserted(() -> {
|
||||
then(this.asyncTask.getSpan().get()).isNotNull();
|
||||
then(this.asyncTask.getSpan().get().getTraceId())
|
||||
.isEqualTo(span.getTraceId());
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.jayway.awaitility.Awaitility;
|
||||
import org.awaitility.Awaitility;
|
||||
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
|
||||
import com.netflix.hystrix.strategy.HystrixPlugins;
|
||||
|
||||
@@ -91,26 +91,20 @@ public class HystrixAnnotationsIntegrationTests {
|
||||
|
||||
private void thenSpanInHystrixThreadIsContinued(final Span span) {
|
||||
then(span).isNotNull();
|
||||
Awaitility.await().atMost(5, SECONDS).until(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Awaitility.await().atMost(5, SECONDS).untilAsserted(() -> {
|
||||
then(HystrixAnnotationsIntegrationTests.this.catcher).isNotNull();
|
||||
then(span)
|
||||
.hasTraceIdEqualTo(HystrixAnnotationsIntegrationTests.this.catcher
|
||||
.getTraceId())
|
||||
.hasNameEqualTo(HystrixAnnotationsIntegrationTests.this.catcher
|
||||
.getSpanName());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void thenSpanInHystrixThreadIsCreated() {
|
||||
Awaitility.await().atMost(5, SECONDS).until(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
then(HystrixAnnotationsIntegrationTests.this.catcher.getSpan())
|
||||
.nameStartsWith("hystrix").isALocalComponentSpan();
|
||||
}
|
||||
Awaitility.await().atMost(5, SECONDS).untilAsserted(() -> {
|
||||
then(HystrixAnnotationsIntegrationTests.this.catcher.getSpan())
|
||||
.nameStartsWith("hystrix").isALocalComponentSpan();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.springframework.cloud.sleuth.instrument.rxjava;
|
||||
|
||||
import static com.jayway.awaitility.Awaitility.await;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.springframework.cloud.sleuth.assertions.SleuthAssertions.then;
|
||||
|
||||
@@ -70,7 +70,7 @@ public class SleuthRxJavaTests {
|
||||
then(this.caller.toString()).isEqualTo("actual_action");
|
||||
then(this.tracer.getCurrentSpan()).isNull();
|
||||
await().atMost(5, SECONDS)
|
||||
.until(() -> then(this.listener.getEvents()).hasSize(1));
|
||||
.untilAsserted(() -> then(this.listener.getEvents()).hasSize(1));
|
||||
then(this.listener.getEvents().get(0)).hasNameEqualTo("rxjava");
|
||||
then(this.listener.getEvents().get(0)).isExportable();
|
||||
then(this.listener.getEvents().get(0)).hasATag(Span.SPAN_LOCAL_COMPONENT_TAG_NAME,
|
||||
|
||||
@@ -16,10 +16,6 @@
|
||||
|
||||
package org.springframework.cloud.sleuth.instrument.scheduling;
|
||||
|
||||
import static com.jayway.awaitility.Awaitility.await;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.springframework.cloud.sleuth.assertions.SleuthAssertions.then;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.hamcrest.Matchers;
|
||||
@@ -36,6 +32,10 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
import static org.springframework.cloud.sleuth.assertions.SleuthAssertions.then;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = { ScheduledTestConfiguration.class })
|
||||
public class TracingOnScheduledTests {
|
||||
@@ -47,13 +47,13 @@ public class TracingOnScheduledTests {
|
||||
|
||||
@Test
|
||||
public void should_have_span_set_after_scheduled_method_has_been_executed() {
|
||||
await().atMost(5, SECONDS).until(spanIsSetOnAScheduledMethod());
|
||||
await().atMost(5, SECONDS).untilAsserted(this::spanIsSetOnAScheduledMethod);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_have_a_new_span_set_each_time_a_scheduled_method_has_been_executed() {
|
||||
Span firstSpan = this.beanWithScheduledMethod.getSpan();
|
||||
await().atMost(5, SECONDS).until(differentSpanHasBeenSetThan(firstSpan));
|
||||
final Span firstSpan = this.beanWithScheduledMethod.getSpan();
|
||||
await().atMost(5, SECONDS).untilAsserted(() -> differentSpanHasBeenSetThan(firstSpan));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -65,27 +65,19 @@ public class TracingOnScheduledTests {
|
||||
}
|
||||
|
||||
private Runnable spanIsSetOnAScheduledMethod() {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Span storedSpan = TracingOnScheduledTests.this.beanWithScheduledMethod
|
||||
.getSpan();
|
||||
then(storedSpan).isNotNull();
|
||||
then(storedSpan.getTraceId()).isNotNull();
|
||||
then(storedSpan).hasATag("class", "TestBeanWithScheduledMethod");
|
||||
then(storedSpan).hasATag("method", "scheduledMethod");
|
||||
}
|
||||
return () -> {
|
||||
Span storedSpan = TracingOnScheduledTests.this.beanWithScheduledMethod
|
||||
.getSpan();
|
||||
then(storedSpan).isNotNull();
|
||||
then(storedSpan.getTraceId()).isNotNull();
|
||||
then(storedSpan).hasATag("class", "TestBeanWithScheduledMethod");
|
||||
then(storedSpan).hasATag("method", "scheduledMethod");
|
||||
};
|
||||
}
|
||||
|
||||
private Runnable differentSpanHasBeenSetThan(final Span spanToCompare) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
then(TracingOnScheduledTests.this.beanWithScheduledMethod.getSpan())
|
||||
.isNotEqualTo(spanToCompare);
|
||||
}
|
||||
};
|
||||
return () -> then(TracingOnScheduledTests.this.beanWithScheduledMethod.getSpan())
|
||||
.isNotEqualTo(spanToCompare);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.jayway.awaitility.Awaitility;
|
||||
import org.awaitility.Awaitility;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
@@ -84,7 +84,7 @@ public class SpringDataInstrumentationTests {
|
||||
|
||||
then(names).isNotEmpty();
|
||||
then(this.arrayListSpanAccumulator.getSpans()).isNotEmpty();
|
||||
Awaitility.await().until(() -> {
|
||||
Awaitility.await().untilAsserted(() -> {
|
||||
then(new ListOfSpans(this.arrayListSpanAccumulator.getSpans()))
|
||||
.hasASpanWithName("http:/reservations")
|
||||
.hasASpanWithTagKeyEqualTo("mvc.controller.class");
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.jayway.awaitility.Awaitility;
|
||||
import org.awaitility.Awaitility;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = {
|
||||
@@ -53,17 +53,13 @@ public class TraceAsyncIntegrationTests {
|
||||
}
|
||||
|
||||
private void thenTraceIdIsPassedFromTheCurrentThreadToTheAsyncOne(final Span span) {
|
||||
Awaitility.await().atMost(5, SECONDS).until(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
then(TraceAsyncIntegrationTests.this.classPerformingAsyncLogic.getSpan())
|
||||
.hasTraceIdEqualTo(span.getTraceId())
|
||||
.hasNameEqualTo("invoke-asynchronous-logic")
|
||||
.isALocalComponentSpan()
|
||||
.hasATag("class", "ClassPerformingAsyncLogic")
|
||||
.hasATag("method", "invokeAsynchronousLogic");
|
||||
}
|
||||
});
|
||||
Awaitility.await().atMost(5, SECONDS).untilAsserted(
|
||||
() -> then(TraceAsyncIntegrationTests.this.classPerformingAsyncLogic.getSpan())
|
||||
.hasTraceIdEqualTo(span.getTraceId())
|
||||
.hasNameEqualTo("invoke-asynchronous-logic")
|
||||
.isALocalComponentSpan()
|
||||
.hasATag("class", "ClassPerformingAsyncLogic")
|
||||
.hasATag("method", "invokeAsynchronousLogic"));
|
||||
}
|
||||
|
||||
@After
|
||||
|
||||
@@ -49,7 +49,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import static com.jayway.awaitility.Awaitility.await;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.springframework.cloud.sleuth.assertions.SleuthAssertions.then;
|
||||
|
||||
@@ -83,9 +83,11 @@ public class TraceFilterCustomExtractorTests {
|
||||
} finally {
|
||||
this.tracer.close(newSpan);
|
||||
}
|
||||
await().atMost(5, SECONDS).until(() -> then(this.accumulator.getSpans().stream().filter(
|
||||
span -> span.getSpanId() == newSpan.getSpanId()).findFirst().get())
|
||||
.hasTraceIdEqualTo(newSpan.getTraceId()));
|
||||
await().atMost(5, SECONDS).untilAsserted(() -> {
|
||||
then(this.accumulator.getSpans().stream().filter(
|
||||
span -> span.getSpanId() == newSpan.getSpanId()).findFirst().get())
|
||||
.hasTraceIdEqualTo(newSpan.getTraceId());
|
||||
});
|
||||
BDDAssertions.then(responseEntity.getBody())
|
||||
.containsEntry("correlationid", Span.idToHex(newSpan.getTraceId()))
|
||||
.containsKey("myspanid")
|
||||
|
||||
@@ -51,7 +51,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.AsyncRestTemplate;
|
||||
|
||||
import com.jayway.awaitility.Awaitility;
|
||||
import org.awaitility.Awaitility;
|
||||
|
||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
||||
import static org.springframework.cloud.sleuth.assertions.SleuthAssertions.then;
|
||||
@@ -206,7 +206,7 @@ public class TraceWebAsyncClientAutoConfigurationTests {
|
||||
|
||||
}
|
||||
|
||||
Awaitility.await().until(() -> {
|
||||
Awaitility.await().untilAsserted(() -> {
|
||||
then(new ArrayList<>(this.accumulator.getSpans()).stream()
|
||||
.filter(span -> span.logs().stream().filter(log -> Span.CLIENT_RECV.equals(log.getEvent()))
|
||||
.findFirst().isPresent()).findFirst().get()).matches(
|
||||
|
||||
@@ -16,10 +16,18 @@
|
||||
|
||||
package org.springframework.cloud.sleuth.instrument.web.client.feign.servererrors;
|
||||
|
||||
import com.netflix.hystrix.exception.HystrixRuntimeException;
|
||||
import com.netflix.loadbalancer.BaseLoadBalancer;
|
||||
import com.netflix.loadbalancer.ILoadBalancer;
|
||||
import com.netflix.loadbalancer.Server;
|
||||
import feign.codec.Decoder;
|
||||
import feign.codec.ErrorDecoder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -54,15 +62,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.jayway.awaitility.Awaitility;
|
||||
import com.netflix.hystrix.exception.HystrixRuntimeException;
|
||||
import com.netflix.loadbalancer.BaseLoadBalancer;
|
||||
import com.netflix.loadbalancer.ILoadBalancer;
|
||||
import com.netflix.loadbalancer.Server;
|
||||
|
||||
import feign.codec.Decoder;
|
||||
import feign.codec.ErrorDecoder;
|
||||
|
||||
import static org.springframework.cloud.sleuth.assertions.SleuthAssertions.then;
|
||||
|
||||
/**
|
||||
@@ -93,7 +92,7 @@ public class FeignClientServerErrorTests {
|
||||
} catch (HystrixRuntimeException e) {
|
||||
}
|
||||
|
||||
Awaitility.await().until(() -> {
|
||||
Awaitility.await().untilAsserted(() -> {
|
||||
then(this.capture.toString())
|
||||
.doesNotContain("Tried to close span but it is not the current span");
|
||||
then(ExceptionUtils.getLastException()).isNull();
|
||||
@@ -110,7 +109,7 @@ public class FeignClientServerErrorTests {
|
||||
} catch (HystrixRuntimeException e) {
|
||||
}
|
||||
|
||||
Awaitility.await().until(() -> {
|
||||
Awaitility.await().untilAsserted(() -> {
|
||||
then(this.capture.toString())
|
||||
.doesNotContain("Tried to close span but it is not the current span");
|
||||
then(ExceptionUtils.getLastException()).isNull();
|
||||
@@ -124,7 +123,7 @@ public class FeignClientServerErrorTests {
|
||||
} catch (HystrixRuntimeException e) {
|
||||
}
|
||||
|
||||
Awaitility.await().until(() -> {
|
||||
Awaitility.await().untilAsserted(() -> {
|
||||
then(this.capture.toString()).doesNotContain("Tried to close span but it is not the current span");
|
||||
then(ExceptionUtils.getLastException()).isNull();
|
||||
});
|
||||
@@ -137,9 +136,10 @@ public class FeignClientServerErrorTests {
|
||||
} catch (HystrixRuntimeException e) {
|
||||
}
|
||||
|
||||
Awaitility.await().until(() -> {
|
||||
Awaitility.await().untilAsserted(() -> {
|
||||
then(this.capture.toString()).doesNotContain("Tried to close span but it is not the current span");
|
||||
then(ExceptionUtils.getLastException()).isNull();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public class FeignClientServerErrorTests {
|
||||
} catch (HystrixRuntimeException e) {
|
||||
}
|
||||
|
||||
Awaitility.await().until(() -> {
|
||||
Awaitility.await().untilAsserted(() -> {
|
||||
then(this.capture.toString()).doesNotContain("Tried to close span but it is not the current span");
|
||||
then(ExceptionUtils.getLastException()).isNull();
|
||||
});
|
||||
|
||||
@@ -69,7 +69,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.jayway.awaitility.Awaitility;
|
||||
import org.awaitility.Awaitility;
|
||||
import com.netflix.loadbalancer.BaseLoadBalancer;
|
||||
import com.netflix.loadbalancer.ILoadBalancer;
|
||||
import com.netflix.loadbalancer.Server;
|
||||
@@ -113,7 +113,7 @@ public class WebClientTests {
|
||||
ResponseEntityProvider provider) {
|
||||
ResponseEntity<String> response = provider.get(this);
|
||||
|
||||
Awaitility.await().atMost(2, TimeUnit.SECONDS).until(() -> {
|
||||
Awaitility.await().atMost(2, TimeUnit.SECONDS).untilAsserted(() -> {
|
||||
then(getHeader(response, Span.TRACE_ID_NAME)).isNull();
|
||||
then(getHeader(response, Span.SPAN_ID_NAME)).isNull();
|
||||
List<Span> spans = new ArrayList<>(this.listener.getSpans());
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import static com.jayway.awaitility.Awaitility.await;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
@@ -59,7 +59,7 @@ public class MultipleHopsIntegrationTests {
|
||||
public void should_prepare_spans_for_export() throws Exception {
|
||||
this.restTemplate.getForObject("http://localhost:" + this.config.port + "/greeting", String.class);
|
||||
|
||||
await().atMost(5, SECONDS).until(() -> {
|
||||
await().atMost(5, SECONDS).untilAsserted(() -> {
|
||||
then(this.arrayListSpanAccumulator.getSpans().stream().map(Span::getName)
|
||||
.collect(
|
||||
toList())).containsAll(asList("http:/greeting", "message:greetings",
|
||||
@@ -82,7 +82,7 @@ public class MultipleHopsIntegrationTests {
|
||||
URI.create("http://localhost:" + this.config.port + "/greeting"));
|
||||
this.restTemplate.exchange(requestEntity, String.class);
|
||||
|
||||
await().atMost(5, SECONDS).until(() -> {
|
||||
await().atMost(5, SECONDS).untilAsserted(() -> {
|
||||
then(new ListOfSpans(this.arrayListSpanAccumulator.getSpans()))
|
||||
.everySpanHasABaggage("foo", "bar")
|
||||
.anySpanHasABaggage("baz", "baz");
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jayway.awaitility</groupId>
|
||||
<groupId>org.awaitility</groupId>
|
||||
<artifactId>awaitility</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -63,11 +63,13 @@ public class MessagingApplicationTests extends AbstractIntegrationTest {
|
||||
public void should_have_passed_trace_id_when_message_is_about_to_be_sent() {
|
||||
long traceId = new Random().nextLong();
|
||||
|
||||
await().atMost(5, SECONDS).until(httpMessageWithTraceIdInHeadersIsSuccessfullySent(sampleAppUrl + "/", traceId));
|
||||
await().atMost(5, SECONDS).untilAsserted(() ->
|
||||
httpMessageWithTraceIdInHeadersIsSuccessfullySent(sampleAppUrl + "/", traceId).run()
|
||||
);
|
||||
|
||||
await().atMost(5, SECONDS).until(() -> {
|
||||
thenAllSpansHaveTraceIdEqualTo(traceId);
|
||||
});
|
||||
await().atMost(5, SECONDS).untilAsserted(() ->
|
||||
thenAllSpansHaveTraceIdEqualTo(traceId)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -75,9 +77,11 @@ public class MessagingApplicationTests extends AbstractIntegrationTest {
|
||||
long traceId = new Random().nextLong();
|
||||
long spanId = new Random().nextLong();
|
||||
|
||||
await().atMost(5, SECONDS).until(httpMessageWithTraceIdInHeadersIsSuccessfullySent(sampleAppUrl + "/", traceId, spanId));
|
||||
await().atMost(5, SECONDS).untilAsserted(() ->
|
||||
httpMessageWithTraceIdInHeadersIsSuccessfullySent(sampleAppUrl + "/", traceId, spanId).run()
|
||||
);
|
||||
|
||||
await().atMost(5, SECONDS).until(() -> {
|
||||
await().atMost(5, SECONDS).untilAsserted(() -> {
|
||||
thenAllSpansHaveTraceIdEqualTo(traceId);
|
||||
thenTheSpansHaveProperParentStructure();
|
||||
});
|
||||
@@ -87,9 +91,11 @@ public class MessagingApplicationTests extends AbstractIntegrationTest {
|
||||
public void should_have_passed_trace_id_with_annotations_in_async_thread_when_message_is_about_to_be_sent() {
|
||||
long traceId = new Random().nextLong();
|
||||
|
||||
await().atMost(5, SECONDS).until(httpMessageWithTraceIdInHeadersIsSuccessfullySent(sampleAppUrl + "/xform", traceId));
|
||||
await().atMost(5, SECONDS).untilAsserted(() ->
|
||||
httpMessageWithTraceIdInHeadersIsSuccessfullySent(sampleAppUrl + "/xform", traceId).run()
|
||||
);
|
||||
|
||||
await().atMost(5, SECONDS).until(() -> {
|
||||
await().atMost(5, SECONDS).untilAsserted(() -> {
|
||||
thenAllSpansHaveTraceIdEqualTo(traceId);
|
||||
thenThereIsAtLeastOneBinaryAnnotationWithKey("background-sleep-millis");
|
||||
});
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jayway.awaitility</groupId>
|
||||
<groupId>org.awaitility</groupId>
|
||||
<artifactId>awaitility</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package tools;
|
||||
|
||||
import zipkin.Codec;
|
||||
import zipkin.Span;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
@@ -24,11 +27,10 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.jayway.awaitility.Awaitility;
|
||||
import com.jayway.awaitility.core.ConditionFactory;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.awaitility.Awaitility;
|
||||
import org.awaitility.core.ConditionFactory;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.springframework.cloud.sleuth.trace.IntegrationTestSpanContextHolder;
|
||||
@@ -39,9 +41,6 @@ import org.springframework.http.RequestEntity;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import zipkin.Codec;
|
||||
import zipkin.Span;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jayway.awaitility</groupId>
|
||||
<groupId>org.awaitility</groupId>
|
||||
<artifactId>awaitility</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -60,7 +60,8 @@ public class ZipkinStreamTests extends AbstractIntegrationTest {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
await().atMost(10, SECONDS).until(zipkinServerIsUp());
|
||||
await().atMost(10, SECONDS)
|
||||
.untilAsserted(() -> zipkinServerIsUp().run());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -70,7 +71,9 @@ public class ZipkinStreamTests extends AbstractIntegrationTest {
|
||||
|
||||
this.input.send(messageWithSpan(span));
|
||||
|
||||
await().atMost(5, SECONDS).until(allSpansWereRegisteredInZipkinWithTraceIdEqualTo(this.traceId));
|
||||
await().atMost(5, SECONDS).untilAsserted(() ->
|
||||
allSpansWereRegisteredInZipkinWithTraceIdEqualTo(this.traceId)
|
||||
);
|
||||
}
|
||||
|
||||
private Message<Spans> messageWithSpan(Span span) {
|
||||
|
||||
@@ -15,6 +15,12 @@
|
||||
*/
|
||||
package integration;
|
||||
|
||||
import integration.ZipkinTests.WaitUntilZipkinIsUpConfig;
|
||||
import sample.SampleZipkinApplication;
|
||||
import tools.AbstractIntegrationTest;
|
||||
import zipkin.junit.ZipkinRule;
|
||||
import zipkin.server.EnableZipkinServer;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -33,12 +39,6 @@ import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import integration.ZipkinTests.WaitUntilZipkinIsUpConfig;
|
||||
import sample.SampleZipkinApplication;
|
||||
import tools.AbstractIntegrationTest;
|
||||
import zipkin.junit.ZipkinRule;
|
||||
import zipkin.server.EnableZipkinServer;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@@ -67,10 +67,14 @@ public class ZipkinTests extends AbstractIntegrationTest {
|
||||
public void should_propagate_spans_to_zipkin() {
|
||||
long traceId = new Random().nextLong();
|
||||
|
||||
await().atMost(10, SECONDS).until(httpMessageWithTraceIdInHeadersIsSuccessfullySent(
|
||||
this.sampleAppUrl + "/hi2", traceId));
|
||||
await().atMost(10, SECONDS).untilAsserted(() ->
|
||||
httpMessageWithTraceIdInHeadersIsSuccessfullySent(
|
||||
this.sampleAppUrl + "/hi2", traceId).run()
|
||||
);
|
||||
|
||||
await().atMost(10, SECONDS).until(allSpansWereRegisteredInZipkinWithTraceIdEqualTo(traceId));
|
||||
await().atMost(10, SECONDS).untilAsserted(() ->
|
||||
allSpansWereRegisteredInZipkinWithTraceIdEqualTo(traceId).run()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jayway.awaitility</groupId>
|
||||
<groupId>org.awaitility</groupId>
|
||||
<artifactId>awaitility</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -16,25 +16,19 @@
|
||||
|
||||
package org.springframework.cloud.sleuth.stream;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.atLeastOnce;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.metrics.CounterService;
|
||||
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.cloud.commons.util.UtilAutoConfiguration;
|
||||
@@ -59,7 +53,11 @@ import org.springframework.integration.annotation.ServiceActivator;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.jayway.awaitility.Awaitility;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.atLeastOnce;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -93,7 +91,7 @@ public class StreamSpanListenerTests {
|
||||
|
||||
this.tracer.close(context);
|
||||
|
||||
Awaitility.await().until(() -> assertThat(StreamSpanListenerTests.this.test.spans()).hasSize(1));
|
||||
Awaitility.await().untilAsserted(() -> assertThat(StreamSpanListenerTests.this.test.spans()).hasSize(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -107,7 +105,7 @@ public class StreamSpanListenerTests {
|
||||
|
||||
this.tracer.close(context);
|
||||
|
||||
Awaitility.await().until(() -> assertThat(StreamSpanListenerTests.this.test.spans()).hasSize(2));
|
||||
Awaitility.await().untilAsserted(() -> assertThat(StreamSpanListenerTests.this.test.spans()).hasSize(2));
|
||||
}
|
||||
|
||||
void logServerReceived(Span parent) {
|
||||
|
||||
Reference in New Issue
Block a user