Fighting flakey tests
This commit is contained in:
@@ -113,7 +113,8 @@ public class MessagingApplicationTests extends AbstractIntegrationTest {
|
||||
.collect(Collectors.joining("\n")) + "\n]");
|
||||
then(this.integrationTestSpanCollector.hashedSpans
|
||||
.stream()
|
||||
.filter(span -> !span.traceId().equals(traceIdHex))
|
||||
.filter(span ->
|
||||
org.springframework.cloud.sleuth.Span.hexToId(span.traceId()) != traceId)
|
||||
.collect(Collectors.toList()))
|
||||
.describedAs("All spans have same trace id [" + traceIdHex + "]")
|
||||
.isEmpty();
|
||||
|
||||
@@ -50,7 +50,7 @@ public abstract class AbstractIntegrationTest {
|
||||
|
||||
|
||||
protected Runnable httpMessageWithTraceIdInHeadersIsSuccessfullySent(String endpoint, long traceId) {
|
||||
return new RequestSendingRunnable(this.restTemplate, endpoint, traceId, null);
|
||||
return new RequestSendingRunnable(this.restTemplate, endpoint, traceId, traceId);
|
||||
}
|
||||
|
||||
protected Runnable httpMessageWithTraceIdInHeadersIsSuccessfullySent(String endpoint, long traceId, Long spanId) {
|
||||
|
||||
@@ -15,22 +15,18 @@
|
||||
*/
|
||||
package integration;
|
||||
|
||||
import integration.ZipkinTests.WaitUntilZipkinIsUpConfig;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import integration.ZipkinTests.WaitUntilZipkinIsUpConfig;
|
||||
import okhttp3.mockwebserver.MockResponse;
|
||||
import okhttp3.mockwebserver.MockWebServer;
|
||||
import okhttp3.mockwebserver.RecordedRequest;
|
||||
import sample.SampleZipkinApplication;
|
||||
import tools.AbstractIntegrationTest;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Random;
|
||||
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -43,6 +39,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import sample.SampleZipkinApplication;
|
||||
import tools.AbstractIntegrationTest;
|
||||
import zipkin2.Span;
|
||||
import zipkin2.codec.SpanBytesDecoder;
|
||||
|
||||
@@ -62,14 +60,6 @@ public class ZipkinTests extends AbstractIntegrationTest {
|
||||
private String sampleAppUrl = "http://localhost:" + this.port;
|
||||
@Autowired ZipkinProperties zipkinProperties;
|
||||
|
||||
int getZipkinServerPort() {
|
||||
return getPortFromProps();
|
||||
}
|
||||
|
||||
private int getPortFromProps() {
|
||||
return URI.create(this.zipkinProperties.getBaseUrl()).getPort();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_propagate_spans_to_zipkin() throws Exception {
|
||||
zipkin.enqueue(new MockResponse());
|
||||
|
||||
Reference in New Issue
Block a user