|
9 | 9 | import com.oracle.coherence.examples.sockshop.spring.carts.model.Item; |
10 | 10 | import com.oracle.coherence.examples.sockshop.spring.test.config.TestSpanConfig; |
11 | 11 | import com.oracle.coherence.examples.sockshop.spring.test.tracing.CustomSpanFilter; |
| 12 | +import lombok.extern.slf4j.Slf4j; |
12 | 13 | import org.junit.jupiter.api.MethodOrderer; |
13 | 14 | import org.junit.jupiter.api.Order; |
14 | 15 | import org.junit.jupiter.api.Test; |
|
22 | 23 | import org.springframework.http.MediaType; |
23 | 24 | import org.springframework.test.annotation.DirtiesContext; |
24 | 25 | import org.springframework.test.web.reactive.server.WebTestClient; |
| 26 | +import org.springframework.util.StringUtils; |
25 | 27 |
|
26 | 28 | import java.util.List; |
27 | 29 |
|
28 | 30 | import static org.assertj.core.api.Assertions.assertThat; |
| 31 | +import static org.awaitility.Awaitility.await; |
29 | 32 |
|
30 | 33 | /** |
31 | 34 | * Integration test to ensure Coherence metrics are properly exposed when |
|
36 | 39 | @SpringBootTest( |
37 | 40 | webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, |
38 | 41 | properties = { |
39 | | - "coherence.metrics.http.enabled=true" |
| 42 | + "coherence.metrics.http.enabled=true", |
| 43 | + "spring.zipkin.enabled=true", |
| 44 | + "spring.sleuth.sampler.probability=1.0" |
40 | 45 | } |
41 | 46 | ) |
42 | 47 | @AutoConfigureWebTestClient |
43 | 48 | @DirtiesContext |
44 | 49 | @TestMethodOrder(MethodOrderer.OrderAnnotation.class) |
45 | 50 | @Import(TestSpanConfig.class) |
| 51 | +@Slf4j |
46 | 52 | public class CartMetricsTests { |
47 | 53 |
|
48 | 54 | public static final int COHERENCE_METRICS_PORT = 9612; |
@@ -85,7 +91,12 @@ void verifyCoherenceMetrics() { |
85 | 91 | @Test |
86 | 92 | @Order(3) |
87 | 93 | void verifySpringCloudSleuthTraces() { |
| 94 | + await().untilAsserted(() -> |
| 95 | + assertThat(this.spanHandler.getSpans()) |
| 96 | + .hasSize(1)); |
| 97 | + |
88 | 98 | final List<FinishedSpan> spans = this.spanHandler.getSpans(); |
| 99 | + log.info("\n" + StringUtils.collectionToDelimitedString(spans, "\n")); |
89 | 100 | assertThat(spans) |
90 | 101 | .hasSize(1) |
91 | 102 | .extracting(FinishedSpan::getName) |
|
0 commit comments