Added tests for exporting to Zipkin
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
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;
|
||||
@@ -125,6 +126,24 @@ public class StreamSpanListenerTests {
|
||||
verify(this.counterService, atLeastOnce()).increment(anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotReportToZipkinWhenSpanIsNotExportable() {
|
||||
Span span = Span.builder().exportable(false).build();
|
||||
|
||||
this.spanReporter.report(span);
|
||||
|
||||
assertThat(this.test.spans).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReportToZipkinWhenSpanIsExportable() {
|
||||
Span span = Span.builder().exportable(true).build();
|
||||
|
||||
this.spanReporter.report(span);
|
||||
|
||||
assertThat(this.test.spans).isNotEmpty();
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import({ ZipkinTestConfiguration.class, SleuthStreamAutoConfiguration.class,
|
||||
TraceMetricsAutoConfiguration.class, TestSupportBinderAutoConfiguration.class,
|
||||
|
||||
@@ -176,6 +176,15 @@ public class ZipkinSpanListenerTests {
|
||||
.containsOnly("fooservice");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotReportToZipkinWhenSpanIsNotExportable() {
|
||||
Span span = Span.builder().exportable(false).build();
|
||||
|
||||
this.spanReporter.report(span);
|
||||
|
||||
assertThat(this.test.zipkinSpans).isEmpty();
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
protected static class TestConfiguration {
|
||||
|
||||
Reference in New Issue
Block a user