Skip to content

Commit 507cef9

Browse files
committed
add tests
1 parent 1288898 commit 507cef9

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.contrib.baggage.processor;
7+
8+
import static org.assertj.core.api.Assertions.assertThat;
9+
10+
import io.opentelemetry.sdk.OpenTelemetrySdk;
11+
import io.opentelemetry.sdk.extension.incubator.fileconfig.DeclarativeConfiguration;
12+
import java.io.ByteArrayInputStream;
13+
import java.nio.charset.StandardCharsets;
14+
import org.junit.jupiter.api.Test;
15+
16+
class BaggageLogRecordComponentProviderTest {
17+
18+
@Test
19+
void declarativeConfig() {
20+
String yaml =
21+
"file_format: 0.4\n"
22+
+ "logger_provider:\n"
23+
+ " processors:\n"
24+
+ " - baggage:\n"
25+
+ " included: [foo]\n"
26+
+ " excluded: [bar]\n";
27+
28+
OpenTelemetrySdk sdk =
29+
DeclarativeConfiguration.parseAndCreate(
30+
new ByteArrayInputStream(yaml.getBytes(StandardCharsets.UTF_8)));
31+
32+
assertThat(sdk).asString().contains("BaggageLogRecordProcessor");
33+
}
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.contrib.baggage.processor;
7+
8+
import static org.assertj.core.api.Assertions.assertThat;
9+
10+
import io.opentelemetry.sdk.OpenTelemetrySdk;
11+
import io.opentelemetry.sdk.extension.incubator.fileconfig.DeclarativeConfiguration;
12+
import java.io.ByteArrayInputStream;
13+
import java.nio.charset.StandardCharsets;
14+
import org.junit.jupiter.api.Test;
15+
16+
class BaggageSpanComponentProviderTest {
17+
18+
@Test
19+
void declarativeConfig() {
20+
String yaml =
21+
"file_format: 0.4\n"
22+
+ "tracer_provider:\n"
23+
+ " processors:\n"
24+
+ " - baggage:\n"
25+
+ " included: [foo]\n"
26+
+ " excluded: [bar]\n";
27+
28+
OpenTelemetrySdk sdk =
29+
DeclarativeConfiguration.parseAndCreate(
30+
new ByteArrayInputStream(yaml.getBytes(StandardCharsets.UTF_8)));
31+
32+
assertThat(sdk).asString().contains("BaggageSpanProcessor");
33+
}
34+
}

0 commit comments

Comments
 (0)