Skip to content

Commit 97b671f

Browse files
committed
feat(opentelemetry): Migrate smoke test to JUnit
1 parent 2932b08 commit 97b671f

4 files changed

Lines changed: 64 additions & 32 deletions

File tree

‎dd-smoke-tests/opentelemetry/gradle.lockfile‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ com.datadoghq:dd-instrument-java:0.0.4=testCompileClasspath,testRuntimeClasspath
1313
com.datadoghq:dd-javac-plugin-client:0.2.2=testCompileClasspath,testRuntimeClasspath
1414
com.datadoghq:java-dogstatsd-client:4.4.5=testRuntimeClasspath
1515
com.datadoghq:sketches-java:0.8.3=testRuntimeClasspath
16+
com.fasterxml.jackson.core:jackson-annotations:2.10.3=testCompileClasspath,testRuntimeClasspath
17+
com.github.docker-java:docker-java-api:3.4.2=testCompileClasspath,testRuntimeClasspath
18+
com.github.docker-java:docker-java-transport-zerodep:3.4.2=testCompileClasspath,testRuntimeClasspath
19+
com.github.docker-java:docker-java-transport:3.4.2=testCompileClasspath,testRuntimeClasspath
1620
com.github.javaparser:javaparser-core:3.25.6=codenarc
1721
com.github.jnr:jffi:1.3.15=testRuntimeClasspath
1822
com.github.jnr:jnr-a64asm:1.0.0=testRuntimeClasspath
@@ -50,20 +54,21 @@ io.opentelemetry:opentelemetry-context:1.19.0=compileClasspath,runtimeClasspath,
5054
io.sqreen:libsqreen:17.4.0=testRuntimeClasspath
5155
javax.servlet:javax.servlet-api:3.1.0=testCompileClasspath,testRuntimeClasspath
5256
jaxen:jaxen:2.0.0=spotbugs
53-
junit:junit:4.13.2=testRuntimeClasspath
57+
junit:junit:4.13.2=testCompileClasspath,testRuntimeClasspath
5458
net.bytebuddy:byte-buddy-agent:1.18.10=testCompileClasspath,testRuntimeClasspath
5559
net.bytebuddy:byte-buddy:1.18.10=testCompileClasspath,testRuntimeClasspath
5660
net.java.dev.jna:jna-platform:5.8.0=testRuntimeClasspath
57-
net.java.dev.jna:jna:5.8.0=testRuntimeClasspath
61+
net.java.dev.jna:jna:5.13.0=testCompileClasspath,testRuntimeClasspath
5862
net.sf.saxon:Saxon-HE:12.9=spotbugs
5963
org.apache.ant:ant-antlr:1.10.14=codenarc
6064
org.apache.ant:ant-junit:1.10.14=codenarc
6165
org.apache.bcel:bcel:6.11.0=spotbugs
66+
org.apache.commons:commons-compress:1.24.0=testCompileClasspath,testRuntimeClasspath
6267
org.apache.commons:commons-lang3:3.19.0=spotbugs
6368
org.apache.commons:commons-text:1.14.0=spotbugs
6469
org.apache.logging.log4j:log4j-api:2.25.2=spotbugs
6570
org.apache.logging.log4j:log4j-core:2.25.2=spotbugs
66-
org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath
71+
org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath,testRuntimeClasspath
6772
org.codehaus.groovy:groovy-ant:3.0.23=codenarc
6873
org.codehaus.groovy:groovy-docgenerator:3.0.23=codenarc
6974
org.codehaus.groovy:groovy-groovydoc:3.0.23=codenarc
@@ -76,10 +81,11 @@ org.codehaus.groovy:groovy:3.0.25=testCompileClasspath,testRuntimeClasspath
7681
org.codenarc:CodeNarc:3.7.0=codenarc
7782
org.dom4j:dom4j:2.2.0=spotbugs
7883
org.gmetrics:GMetrics:2.1.0=codenarc
79-
org.hamcrest:hamcrest-core:1.3=testRuntimeClasspath
84+
org.hamcrest:hamcrest-core:1.3=testCompileClasspath,testRuntimeClasspath
8085
org.hamcrest:hamcrest:3.0=testCompileClasspath,testRuntimeClasspath
8186
org.jctools:jctools-core-jdk11:4.0.6=testRuntimeClasspath
8287
org.jctools:jctools-core:4.0.6=testRuntimeClasspath
88+
org.jetbrains:annotations:17.0.0=testCompileClasspath,testRuntimeClasspath
8389
org.jspecify:jspecify:1.0.0=testCompileClasspath,testRuntimeClasspath
8490
org.junit.jupiter:junit-jupiter-api:5.14.1=testCompileClasspath,testRuntimeClasspath
8591
org.junit.jupiter:junit-jupiter-engine:5.14.1=testRuntimeClasspath
@@ -107,15 +113,17 @@ org.ow2.asm:asm-util:9.7.1=testRuntimeClasspath
107113
org.ow2.asm:asm-util:9.9=spotbugs
108114
org.ow2.asm:asm:9.10.1=testCompileClasspath,testRuntimeClasspath
109115
org.ow2.asm:asm:9.9=spotbugs
116+
org.rnorth.duct-tape:duct-tape:1.0.8=testCompileClasspath,testRuntimeClasspath
110117
org.slf4j:jcl-over-slf4j:1.7.30=testCompileClasspath,testRuntimeClasspath
111118
org.slf4j:jul-to-slf4j:1.7.30=testCompileClasspath,testRuntimeClasspath
112119
org.slf4j:log4j-over-slf4j:1.7.30=testCompileClasspath,testRuntimeClasspath
113-
org.slf4j:slf4j-api:1.7.32=testCompileClasspath,testRuntimeClasspath
120+
org.slf4j:slf4j-api:1.7.36=testCompileClasspath,testRuntimeClasspath
114121
org.slf4j:slf4j-api:2.0.17=spotbugs,spotbugsSlf4j
115122
org.slf4j:slf4j-simple:2.0.17=spotbugsSlf4j
116123
org.spockframework:spock-bom:2.4-groovy-3.0=testCompileClasspath,testRuntimeClasspath
117124
org.spockframework:spock-core:2.4-groovy-3.0=testCompileClasspath,testRuntimeClasspath
118125
org.tabletest:tabletest-junit:1.2.1=testCompileClasspath,testRuntimeClasspath
119126
org.tabletest:tabletest-parser:1.2.0=testCompileClasspath,testRuntimeClasspath
127+
org.testcontainers:testcontainers:1.21.4=testCompileClasspath,testRuntimeClasspath
120128
org.xmlresolver:xmlresolver:5.3.3=spotbugs
121129
empty=annotationProcessor,shadow,spotbugsPlugins,testAnnotationProcessor

‎dd-smoke-tests/opentelemetry/src/test/groovy/datadog/smoketest/OpenTelemetrySmokeTest.groovy‎

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package datadog.smoketest;
2+
3+
import static datadog.smoketest.backend.AgentBackend.testAgent;
4+
import static datadog.smoketest.trace.SmokeTraceAssertions.DEFAULT_OPTIONS;
5+
import static datadog.smoketest.trace.SpanMatcher.span;
6+
import static datadog.smoketest.trace.TraceMatcher.trace;
7+
import static java.util.concurrent.TimeUnit.SECONDS;
8+
9+
import java.io.File;
10+
import org.junit.jupiter.api.Test;
11+
import org.junit.jupiter.api.extension.RegisterExtension;
12+
13+
class OpenTelemetrySmokeTest {
14+
private static final int TIMEOUT_SECONDS = 30;
15+
private static final File WORKING_DIRECTORY =
16+
new File(System.getProperty("datadog.smoketest.builddir"));
17+
private static final String APPLICATION_JAR =
18+
System.getProperty("datadog.smoketest.shadowJar.path");
19+
20+
@RegisterExtension
21+
static final SmokeCliApp app =
22+
SmokeCliApp.named("opentelemetry")
23+
.jar(APPLICATION_JAR)
24+
.jvmArgs("-Ddd.trace.otel.enabled=true")
25+
.workingDirectory(WORKING_DIRECTORY)
26+
.backend(testAgent())
27+
.build();
28+
29+
@Test
30+
void receivesTraces() {
31+
app.traces()
32+
.assertTraces(
33+
TIMEOUT_SECONDS,
34+
DEFAULT_OPTIONS,
35+
trace(span().root().operationName("Application.annotatedSpan")),
36+
trace(span().root().resourceName("span-0")),
37+
trace(span().root().resourceName("span-1")),
38+
trace(span().root().resourceName("span-2")),
39+
trace(span().root().resourceName("span-3")),
40+
trace(span().root().resourceName("span-4")),
41+
trace(span().root().resourceName("span-5")),
42+
trace(span().root().resourceName("span-6")),
43+
trace(span().root().resourceName("span-7")),
44+
trace(span().root().resourceName("span-8")),
45+
trace(span().root().resourceName("span-9")));
46+
app.assertCompletesWithValue(TIMEOUT_SECONDS, SECONDS, 0);
47+
}
48+
}

‎dd-smoke-tests/src/main/java/datadog/smoketest/trace/SmokeTraceAssertions.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public final class SmokeTraceAssertions {
4242
/*
4343
* Trace assertion options.
4444
*/
45+
/** Default trace assert options. */
46+
public static final UnaryOperator<Options> DEFAULT_OPTIONS = identity();
47+
4548
/** Ignores additional traces. If there are more traces than expected, do not fail. */
4649
public static final UnaryOperator<Options> IGNORE_ADDITIONAL_TRACES =
4750
Options::ignoreAdditionalTraces;

0 commit comments

Comments
 (0)