Skip to content

Migrate smoke tests to environment component #9100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2044,7 +2044,7 @@ public void duplicateLocalDifferentScope() throws IOException, URISyntaxExceptio

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
public void mixingIntAndLongWhenHoisting() throws IOException, URISyntaxException {
final String CLASS_NAME = "com.datadog.debugger.CapturedSnapshot31";
Expand All @@ -2063,7 +2063,7 @@ public void mixingIntAndLongWhenHoisting() throws IOException, URISyntaxExceptio

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
public void mixingIntAndCharWhenHoisting() throws IOException, URISyntaxException {
final String CLASS_NAME = "com.datadog.debugger.CapturedSnapshot31";
Expand All @@ -2082,7 +2082,7 @@ public void mixingIntAndCharWhenHoisting() throws IOException, URISyntaxExceptio

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
public void mixingIntAndRefTypeWhenHoisting() throws IOException, URISyntaxException {
final String CLASS_NAME = "com.datadog.debugger.CapturedSnapshot31";
Expand All @@ -2101,7 +2101,7 @@ public void mixingIntAndRefTypeWhenHoisting() throws IOException, URISyntaxExcep

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
public void sameSlotAndTypeDifferentName() throws IOException, URISyntaxException {
final String CLASS_NAME = "com.datadog.debugger.CapturedSnapshot31";
Expand All @@ -2125,7 +2125,7 @@ public void sameSlotAndTypeDifferentName() throws IOException, URISyntaxExceptio

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
public void sameSlotAndNameOneReturn() throws IOException, URISyntaxException {
final String CLASS_NAME = "com.datadog.debugger.CapturedSnapshot31";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

import com.squareup.moshi.JsonAdapter;
import com.squareup.moshi.Moshi;
import datadog.trace.api.Platform;
import datadog.environment.JavaVirtualMachine;
import datadog.environment.OperatingSystem;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -49,7 +50,7 @@ public class CrashtrackingSmokeTest {
@BeforeAll
static void setupAll() {
// Only Hotspot based implementation are supported
assumeFalse(Platform.isJ9());
assumeFalse(JavaVirtualMachine.isJ9());
}

private Path tempDir;
Expand Down Expand Up @@ -127,7 +128,7 @@ private static String agentShadowJar() {
}

private static String getExtension() {
return Platform.isWindows() ? "bat" : "sh";
return OperatingSystem.isWindows() ? "bat" : "sh";
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

import com.datadog.debugger.sink.Snapshot;
import datadog.trace.api.Platform;
import datadog.environment.JavaVirtualMachine;
import datadog.trace.bootstrap.debugger.CapturedContext;
import datadog.trace.test.agent.decoder.DecodedSpan;
import datadog.trace.test.agent.decoder.DecodedTrace;
Expand Down Expand Up @@ -44,7 +44,7 @@ protected ProcessBuilder createProcessBuilder(Path logFilePath, String... params
@Test
@DisplayName("testSimpleSingleFrameException")
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
void testSimpleSingleFrameException() throws Exception {
appUrl = startAppAndAndGetUrl();
Expand Down Expand Up @@ -74,7 +74,7 @@ void testSimpleSingleFrameException() throws Exception {
@Test
@DisplayName("testNoSubsequentCaptureAfterFirst")
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
void testNoSubsequentCaptureAfterFirst() throws Exception {
appUrl = startAppAndAndGetUrl();
Expand Down Expand Up @@ -107,7 +107,7 @@ void testNoSubsequentCaptureAfterFirst() throws Exception {
@Test
@DisplayName("test3CapturedFrames")
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
void test3CapturedFrames() throws Exception {
appUrl = startAppAndAndGetUrl();
Expand Down Expand Up @@ -163,7 +163,7 @@ void test3CapturedFrames() throws Exception {
@Test
@DisplayName("test5CapturedFrames")
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
void test5CapturedFrames() throws Exception {
additionalJvmArgs.add("-Ddd.exception.replay.capture.max.frames=5");
Expand Down Expand Up @@ -240,7 +240,7 @@ void test5CapturedFrames() throws Exception {
@Test
@DisplayName("test3CapturedRecursiveFrames")
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
void test3CapturedRecursiveFrames() throws Exception {
appUrl = startAppAndAndGetUrl();
Expand Down Expand Up @@ -284,7 +284,9 @@ private static void assertRecursiveSnapshot(Snapshot snapshot) {

@Test
@DisplayName("testLambdaHiddenFrames")
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "HotSpot specific test")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "HotSpot specific test")
void testLambdaHiddenFrames() throws Exception {
additionalJvmArgs.add("-XX:+UnlockDiagnosticVMOptions");
additionalJvmArgs.add("-XX:+ShowHiddenFrames");
Expand Down Expand Up @@ -325,7 +327,7 @@ private void resetSnapshotsAndTraces() {
}

private void assertFullMethodCaptureArgs(CapturedContext context) {
if (Platform.isJ9()) {
if (JavaVirtualMachine.isJ9()) {
// skip for J9/OpenJ9 as we cannot get local variable debug info.
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.datadog.debugger.probe.LogProbe;
import com.datadog.debugger.sink.Snapshot;
import com.squareup.moshi.JsonAdapter;
import datadog.trace.api.Platform;
import datadog.environment.JavaVirtualMachine;
import datadog.trace.bootstrap.debugger.CapturedContext;
import datadog.trace.bootstrap.debugger.MethodLocation;
import datadog.trace.bootstrap.debugger.ProbeId;
Expand Down Expand Up @@ -279,22 +279,28 @@ void testLineProbe() throws Exception {

@Test
@DisplayName("testSamplingSnapshotDefault")
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
void testSamplingSnapshotDefault() throws Exception {
doSamplingSnapshot(null, MethodLocation.EXIT);
}

@Test
@DisplayName("testSamplingSnapshotDefaultWithConditionAtEntry")
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
void testSamplingSnapshotDefaultWithConditionAtEntry() throws Exception {
doSamplingSnapshot(
new ProbeCondition(DSL.when(DSL.eq(value(1), value(1))), "1 == 1"), MethodLocation.ENTRY);
}

@Test
@DisplayName("testSamplingSnapshotDefaultWithConditionAtExit")
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
void testSamplingSnapshotDefaultWithConditionAtExit() throws Exception {
doSamplingSnapshot(
new ProbeCondition(DSL.when(DSL.eq(value(1), value(1))), "1 == 1"), MethodLocation.EXIT);
Expand Down Expand Up @@ -323,7 +329,9 @@ private void doSamplingSnapshot(ProbeCondition probeCondition, MethodLocation ev

@Test
@DisplayName("testSamplingLogDefault")
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
void testSamplingLogDefault() throws Exception {
batchSize = 100;
final int LOOP_COUNT = 1000;
Expand All @@ -347,7 +355,9 @@ void testSamplingLogDefault() throws Exception {

@Test
@DisplayName("testSamplingLogCustom")
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
void testSamplingLogCustom() throws Exception {
final int LOOP_COUNT = 1000;
final String LOG_TEMPLATE = "log line {argInt} {argStr} {argDouble} {argMap} {argVar}";
Expand Down Expand Up @@ -460,7 +470,7 @@ private ProbeId getProbeId(int i) {
}

private void assertFullMethodCaptureArgs(CapturedContext context) {
if (Platform.isJ9()) {
if (JavaVirtualMachine.isJ9()) {
// skip for J9/OpenJ9 as we cannot get local variable debug info.
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ void setup(TestInfo testInfo) throws Exception {

@Test
@DisplayName("testAddRemoveProbes")
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
void testAddRemoveProbes() throws Exception {
LogProbe logProbe =
LogProbe.builder().probeId(PROBE_ID).where(TEST_APP_CLASS_NAME, FULL_METHOD_NAME).build();
Expand All @@ -50,7 +52,9 @@ void testAddRemoveProbes() throws Exception {

@Test
@DisplayName("testDisableEnableProbes")
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
void testDisableEnableProbes() throws Exception {
LogProbe logProbe =
LogProbe.builder().probeId(PROBE_ID).where(TEST_APP_CLASS_NAME, FULL_METHOD_NAME).build();
Expand All @@ -72,7 +76,9 @@ void testDisableEnableProbes() throws Exception {

@Test
@DisplayName("testDisableEnableProbesUsingDenyList")
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
@Disabled("Not supported for config coming from RemoteConfig")
void testDisableEnableProbesUsingDenyList() throws Exception {
LogProbe logProbe =
Expand Down Expand Up @@ -104,7 +110,9 @@ void testDisableEnableProbesUsingDenyList() throws Exception {

@Test
@DisplayName("testDisableEnableProbesUsingAllowList")
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
@Disabled("Not supported for config coming from RemoteConfig")
void testDisableEnableProbesUsingAllowList() throws Exception {
LogProbe logProbe =
Expand Down Expand Up @@ -136,7 +144,9 @@ void testDisableEnableProbesUsingAllowList() throws Exception {

@Test
@DisplayName("testProbeStatusError")
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
public void testProbeStatusError() throws Exception {
LogProbe logProbe =
LogProbe.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected ProcessBuilder createProcessBuilder(Path logFilePath, String... params
@Test
@DisplayName("testMethodSimpleTagNoCondition")
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
void testMethodSimpleTagNoCondition() throws Exception {
SpanDecorationProbe spanDecorationProbe =
Expand Down Expand Up @@ -79,7 +79,7 @@ void testMethodSimpleTagNoCondition() throws Exception {
@Test
@DisplayName("testMethodMultiTagsMultiConditions")
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
void testMethodMultiTagsMultiConditions() throws Exception {
List<SpanDecorationProbe.Decoration> decorations =
Expand Down Expand Up @@ -125,7 +125,9 @@ void testMethodMultiTagsMultiConditions() throws Exception {

@Test
@DisplayName("testMethodSimpleTagValueError")
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
void testMethodSimpleTagValueError() throws Exception {
SpanDecorationProbe spanDecorationProbe =
SpanDecorationProbe.builder()
Expand Down Expand Up @@ -162,7 +164,9 @@ void testMethodSimpleTagValueError() throws Exception {

@Test
@DisplayName("testMethodSimpleTagConditionError")
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
void testMethodSimpleTagConditionError() throws Exception {
SpanDecorationProbe spanDecorationProbe =
SpanDecorationProbe.builder()
Expand Down Expand Up @@ -201,7 +205,9 @@ void testMethodSimpleTagConditionError() throws Exception {

@Test
@DisplayName("testMethodMultiTagValueError")
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
void testMethodMultiTagValueError() throws Exception {
List<SpanDecorationProbe.Decoration> decorations =
Arrays.asList(
Expand Down Expand Up @@ -246,7 +252,9 @@ void testMethodMultiTagValueError() throws Exception {

@Test
@DisplayName("testSamplingSpanDecoration")
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
void testSamplingSpanDecoration() throws Exception {
SpanDecorationProbe spanDecorationProbe =
SpanDecorationProbe.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ void testLineRangeSpan() throws Exception {

@Test
@DisplayName("testSingleLineSpan")
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
void testSingleLineSpan() throws Exception {
final String METHOD_NAME = "fullMethod";
final String EXPECTED_UPLOADS = "2"; // 2 probe statuses: RECEIVED + ERROR
Expand Down
Loading