From c9aade885391dfab0e913ecd57b539d88cb9de28 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Fri, 2 Nov 2018 13:36:29 +0100 Subject: [PATCH] Made tests less brittle --- .../TraceWebAsyncClientAutoConfigurationTests.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfigurationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfigurationTests.java index 11126eb2c..1a06c5bb2 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfigurationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfigurationTests.java @@ -89,11 +89,13 @@ public class TraceWebAsyncClientAutoConfigurationTests { initialSpan.finish(); } - then(this.accumulator - .getSpans().stream().filter(span -> Span.Kind.CLIENT == span.kind()) - .findFirst().get()).matches( - span -> span.duration() >= TimeUnit.MILLISECONDS.toMicros(100)); - then(this.tracer.tracer().currentSpan()).isNull(); + Awaitility.await().untilAsserted(() -> { + then(this.accumulator + .getSpans().stream().filter(span -> Span.Kind.CLIENT == span.kind()) + .findFirst().get()).matches( + span -> span.duration() >= TimeUnit.MILLISECONDS.toMicros(100)); + then(this.tracer.tracer().currentSpan()).isNull(); + }); } @Test