Skip to content

Commit ff752c2

Browse files
committed
start splitting tests:
1 parent 3022b24 commit ff752c2

File tree

5 files changed

+50
-11
lines changed

5 files changed

+50
-11
lines changed

instrumentation/camel-2.20/javaagent/build.gradle.kts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ dependencies {
7070
tasks {
7171
withType<Test>().configureEach {
7272
// TODO run tests both with and without experimental span attributes
73-
jvmArgs("-Dotel.instrumentation.camel.experimental-span-attributes=true")
73+
// jvmArgs("-Dotel.instrumentation.camel.experimental-span-attributes=true")
74+
7475
jvmArgs("-Dotel.instrumentation.aws-sdk.experimental-span-attributes=true")
7576

7677
// TODO: fix camel instrumentation so that it uses semantic attributes extractors
@@ -83,12 +84,16 @@ tasks {
8384
jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true")
8485
}
8586

87+
val testExperimental by registering(Test::class) {
88+
jvmArgs("-Dotel.instrumentation.camel.experimental-span-attributes=true")
89+
}
90+
8691
val testStableSemconv by registering(Test::class) {
8792
jvmArgs("-Dotel.semconv-stability.opt-in=database")
8893
}
8994

9095
check {
91-
dependsOn(testStableSemconv)
96+
dependsOn(testStableSemconv, testExperimental)
9297
}
9398
}
9499

instrumentation/camel-2.20/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/DirectCamelTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package io.opentelemetry.javaagent.instrumentation.apachecamel;
77

88
import static io.opentelemetry.api.common.AttributeKey.stringKey;
9+
import static io.opentelemetry.javaagent.instrumentation.apachecamel.ExperimentalTest.experimental;
910
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
1011

1112
import io.opentelemetry.api.trace.SpanKind;
@@ -70,12 +71,12 @@ void simpleDirectToSingleService() {
7071
.hasKind(SpanKind.INTERNAL)
7172
.hasNoParent()
7273
.hasAttributesSatisfyingExactly(
73-
equalTo(stringKey("camel.uri"), "direct://input")),
74+
equalTo(stringKey("camel.uri"), experimental("direct://input"))),
7475
span ->
7576
span.hasName("receiver")
7677
.hasKind(SpanKind.INTERNAL)
7778
.hasParent(trace.getSpan(0))
7879
.hasAttributesSatisfyingExactly(
79-
equalTo(stringKey("camel.uri"), "direct://receiver"))));
80+
equalTo(stringKey("camel.uri"), experimental("direct://receiver")))));
8081
}
8182
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.javaagent.instrumentation.apachecamel;
7+
8+
import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions;
9+
10+
class ExperimentalTest {
11+
private static final String EXPERIMENTAL_FLAG =
12+
"otel.instrumentation.camel.experimental-span-attributes";
13+
14+
static String experimental(String value) {
15+
if (!Boolean.getBoolean(EXPERIMENTAL_FLAG)) {
16+
return null;
17+
}
18+
return value;
19+
}
20+
21+
static OpenTelemetryAssertions.StringAssertConsumer experimental(
22+
OpenTelemetryAssertions.StringAssertConsumer value) {
23+
if (!Boolean.getBoolean(EXPERIMENTAL_FLAG)) {
24+
return null;
25+
}
26+
return value;
27+
}
28+
29+
private ExperimentalTest() {}
30+
}

instrumentation/camel-2.20/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/MulticastDirectCamelTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package io.opentelemetry.javaagent.instrumentation.apachecamel;
77

88
import static io.opentelemetry.api.common.AttributeKey.stringKey;
9+
import static io.opentelemetry.javaagent.instrumentation.apachecamel.ExperimentalTest.experimental;
910
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
1011

1112
import io.opentelemetry.api.trace.SpanKind;
@@ -70,18 +71,18 @@ void parallelMulticastToTwoChildServices() {
7071
.hasKind(SpanKind.INTERNAL)
7172
.hasNoParent()
7273
.hasAttributesSatisfyingExactly(
73-
equalTo(stringKey("camel.uri"), "direct://input")),
74+
equalTo(stringKey("camel.uri"), experimental("direct://input"))),
7475
span ->
7576
span.hasName("first")
7677
.hasKind(SpanKind.INTERNAL)
7778
.hasParent(trace.getSpan(0))
7879
.hasAttributesSatisfyingExactly(
79-
equalTo(stringKey("camel.uri"), "direct://first")),
80+
equalTo(stringKey("camel.uri"), experimental("direct://first"))),
8081
span ->
8182
span.hasName("second")
8283
.hasKind(SpanKind.INTERNAL)
8384
.hasParent(trace.getSpan(0))
8485
.hasAttributesSatisfyingExactly(
85-
equalTo(stringKey("camel.uri"), "direct://second"))));
86+
equalTo(stringKey("camel.uri"), experimental("direct://second")))));
8687
}
8788
}

instrumentation/camel-2.20/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/RestCamelTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package io.opentelemetry.javaagent.instrumentation.apachecamel;
77

88
import static io.opentelemetry.api.common.AttributeKey.stringKey;
9+
import static io.opentelemetry.javaagent.instrumentation.apachecamel.ExperimentalTest.experimental;
910
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
1011
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies;
1112
import static io.opentelemetry.semconv.ClientAttributes.CLIENT_ADDRESS;
@@ -92,15 +93,15 @@ void restComponentServerAndClientCallWithJettyBackend() {
9293
span.hasName("start")
9394
.hasKind(SpanKind.INTERNAL)
9495
.hasAttributesSatisfyingExactly(
95-
equalTo(stringKey("camel.uri"), "direct://start")),
96+
equalTo(stringKey("camel.uri"), experimental("direct://start"))),
9697
span ->
9798
span.hasName("GET")
9899
.hasKind(SpanKind.CLIENT)
99100
.hasParent(trace.getSpan(0))
100101
.hasAttributesSatisfyingExactly(
101102
equalTo(
102103
stringKey("camel.uri"),
103-
"rest://get:api/%7Bmodule%7D/unit/%7BunitId%7D"),
104+
experimental("rest://get:api/%7Bmodule%7D/unit/%7BunitId%7D")),
104105
equalTo(HTTP_REQUEST_METHOD, "GET"),
105106
equalTo(HTTP_RESPONSE_STATUS_CODE, 200L)),
106107
span ->
@@ -130,12 +131,13 @@ void restComponentServerAndClientCallWithJettyBackend() {
130131
URL_FULL,
131132
"http://localhost:" + port + "/api/firstModule/unit/unitOne"),
132133
satisfies(
133-
stringKey("camel.uri"), val -> val.isInstanceOf(String.class))),
134+
stringKey("camel.uri"),
135+
experimental(val -> val.isInstanceOf(String.class)))),
134136
span ->
135137
span.hasName("moduleUnit")
136138
.hasKind(SpanKind.INTERNAL)
137139
.hasParent(trace.getSpan(3))
138140
.hasAttributesSatisfyingExactly(
139-
equalTo(stringKey("camel.uri"), "direct://moduleUnit"))));
141+
equalTo(stringKey("camel.uri"), experimental("direct://moduleUnit")))));
140142
}
141143
}

0 commit comments

Comments
 (0)