Skip to content

Commit 702888d

Browse files
committed
WIP
1 parent dc0e777 commit 702888d

1 file changed

Lines changed: 21 additions & 18 deletions

File tree

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,44 @@
11
package datadog.smoketest;
22

3+
import static datadog.smoketest.backend.TraceBackend.testAgent;
4+
import static datadog.smoketest.trace.SpanMatcher.span;
5+
import static datadog.smoketest.trace.TraceMatcher.trace;
36
import static java.util.concurrent.TimeUnit.SECONDS;
47

5-
import datadog.smoketest.backend.EnabledIfDockerAvailable;
6-
import datadog.smoketest.backend.TraceBackend;
78
import java.io.File;
89
import org.junit.jupiter.api.Test;
910
import org.junit.jupiter.api.extension.RegisterExtension;
1011

11-
/**
12-
* S8 pilot — ported from the Groovy {@code OpenTelemetrySmokeTest} onto the new Java smoke base.
13-
* The OpenTelemetry sample app runs under the agent (OTel enabled), emits its traces, and exits;
14-
* the test-agent backend must receive all of them. This is the first end-to-end exercise of the new
15-
* base with a real agent and a non-server (batch) app. The {@code .testAgent()} container backend
16-
* needs Docker, so the test is skipped when Docker is unavailable.
17-
*/
18-
@EnabledIfDockerAvailable
1912
class OpenTelemetrySmokeTest {
2013
private static final int TIMEOUT_SECONDS = 30;
14+
private static final File WORKING_DIRECTORY = new File(System.getProperty("datadog.smoketest.builddir"));
15+
private static final String APPLICATION_JAR = System.getProperty("datadog.smoketest.shadowJar.path");
2116

2217
@RegisterExtension
2318
static final SmokeApp app =
2419
SmokeApp.named("opentelemetry")
25-
.jar(System.getProperty("datadog.smoketest.shadowJar.path"))
20+
.jar(APPLICATION_JAR)
2621
.jvmArgs("-Ddd.trace.otel.enabled=true")
27-
.backend(TraceBackend.testAgent())
22+
.workingDirectory(WORKING_DIRECTORY)
2823
.notAServer()
29-
.workingDirectory(new File(System.getProperty("datadog.smoketest.builddir")))
24+
.backend(testAgent())
3025
.build();
3126

3227
@Test
3328
void receivesTraces() {
34-
// 1 @WithSpan-annotated span + 10 manual OpenTelemetry spans, each its own trace.
35-
app.traces().waitForTraceCount(11, TIMEOUT_SECONDS);
36-
37-
// The app then runs to completion and exits cleanly. (app-started telemetry is asserted
38-
// automatically at teardown by SmokeApp's default check — the test body needn't check it.)
29+
app.traces().assertTraces(
30+
trace(span().root().operationName("Application.annotatedSpan")),
31+
trace(span().root().resourceName("span-0")),
32+
trace(span().root().resourceName("span-1")),
33+
trace(span().root().resourceName("span-2")),
34+
trace(span().root().resourceName("span-3")),
35+
trace(span().root().resourceName("span-4")),
36+
trace(span().root().resourceName("span-5")),
37+
trace(span().root().resourceName("span-6")),
38+
trace(span().root().resourceName("span-7")),
39+
trace(span().root().resourceName("span-8")),
40+
trace(span().root().resourceName("span-9"))
41+
);
3942
app.assertCompletesWithValue(TIMEOUT_SECONDS, SECONDS, 0);
4043
}
4144
}

0 commit comments

Comments
 (0)