Skip to content

Commit 9d31fc8

Browse files
committed
test
1 parent 2691442 commit 9d31fc8

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/logging/LoggingExporterAutoConfigurationTest.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,14 @@
99

1010
import io.opentelemetry.api.OpenTelemetry;
1111
import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration;
12-
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
13-
import io.opentelemetry.instrumentation.testing.junit.LibraryInstrumentationExtension;
1412
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
1513
import io.opentelemetry.sdk.autoconfigure.spi.internal.DefaultConfigProperties;
1614
import java.util.Collections;
1715
import org.junit.jupiter.api.Test;
18-
import org.junit.jupiter.api.extension.RegisterExtension;
1916
import org.springframework.boot.autoconfigure.AutoConfigurations;
2017
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
2118

2219
class LoggingExporterAutoConfigurationTest {
23-
@RegisterExtension
24-
static final InstrumentationExtension testing = LibraryInstrumentationExtension.create();
25-
2620
private final ApplicationContextRunner runner =
2721
new ApplicationContextRunner()
2822
.withBean(
@@ -35,20 +29,28 @@ class LoggingExporterAutoConfigurationTest {
3529
@Test
3630
void instrumentationEnabled() {
3731
runner
38-
.withPropertyValues("otel.debug=true")
32+
.withPropertyValues("otel.debug=true", "otel.traces.exporter=none")
3933
.run(
4034
context ->
4135
assertThat(context.getBean(OpenTelemetry.class).toString())
42-
.containsOnlyOnce("cntscnt"));
36+
.containsOnlyOnce("LoggingSpanExporter"));
4337
}
4438

4539
@Test
46-
void instrumentationDisabled() {
40+
void alreadyAdded() {
4741
runner
48-
.withPropertyValues("otel.debug=false")
42+
.withPropertyValues("otel.debug=true", "otel.traces.exporter=logging")
4943
.run(
5044
context ->
5145
assertThat(context.getBean(OpenTelemetry.class).toString())
52-
.doesNotContain("cntscnt"));
46+
.containsOnlyOnce("LoggingSpanExporter"));
47+
}
48+
49+
@Test
50+
void instrumentationDisabled() {
51+
runner.run(
52+
context ->
53+
assertThat(context.getBean(OpenTelemetry.class).toString())
54+
.doesNotContain("LoggingSpanExporter"));
5355
}
5456
}

testing-common/src/main/java/io/opentelemetry/instrumentation/testing/provider/TestExporterCustomizerProvider.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@
2626
import java.util.List;
2727

2828
public class TestExporterCustomizerProvider implements DeclarativeConfigurationCustomizerProvider {
29-
30-
@Override
31-
public int order() {
32-
return Integer.MIN_VALUE; // run before other customizers that might add exporters
33-
}
34-
3529
@Override
3630
public void customize(DeclarativeConfigurationCustomizer customizer) {
3731
if (TestSpanExporterComponentProvider.getSpanExporter() == null) {

0 commit comments

Comments
 (0)