Skip to content
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
2 changes: 2 additions & 0 deletions dd-smoke-tests/crashtracking/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ jar {
dependencies {
testImplementation project(':dd-smoke-tests')
testImplementation project(':dd-java-agent:agent-profiling:profiling-testing')

testImplementation libs.bundles.junit5
testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.1'
testImplementation libs.bundles.mockito
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package datadog.smoketest;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeFalse;

import datadog.trace.api.Platform;
Expand All @@ -23,6 +24,10 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

/*
* NOTE: The current implementation of crash tracking doesn't work with ancient version of bash
* that ships with OS X by default.
*/
public class CrashtrackingSmokeTest {
private MockWebServer tracingServer;

Expand Down Expand Up @@ -76,6 +81,10 @@ private static String getExtension() {
return Platform.isWindows() ? "bat" : "sh";
}

/*
* NOTE: The current implementation of crash tracking doesn't work with ancient version of bash
* that ships with OS X by default.
*/
@Test
void testCrashTracking() throws Exception {
Path script = tempDir.resolve("dd_crash_uploader." + getExtension());
Expand Down Expand Up @@ -140,14 +149,17 @@ void testCrashTracking() throws Exception {

assertNotEquals(0, p.waitFor(), "Application should have crashed");

assertTrue(stdoutStr.toString().contains(" was uploaded successfully"));
assertTrue(
stderrStr
.toString()
.contains(
"com.datadog.crashtracking.CrashUploader - Successfully uploaded the crash files"));
assertThat(stdoutStr.toString(), containsString(" was uploaded successfully"));
assertThat(
stderrStr.toString(),
containsString(
"com.datadog.crashtracking.CrashUploader - Successfully uploaded the crash files"));
}

/*
* NOTE: The current implementation of crash tracking doesn't work with ancient version of bash
* that ships with OS X by default.
*/
@Test
void testCrashTrackingLegacy() throws Exception {
Path script = tempDir.resolve("dd_crash_uploader." + getExtension());
Expand Down Expand Up @@ -212,14 +224,17 @@ void testCrashTrackingLegacy() throws Exception {

assertNotEquals(0, p.waitFor(), "Application should have crashed");

assertTrue(stdoutStr.toString().contains(" was uploaded successfully"));
assertTrue(
stderrStr
.toString()
.contains(
"com.datadog.crashtracking.CrashUploader - Successfully uploaded the crash files"));
assertThat(stdoutStr.toString(), containsString(" was uploaded successfully"));
assertThat(
stderrStr.toString(),
containsString(
"com.datadog.crashtracking.CrashUploader - Successfully uploaded the crash files"));
}

/*
* NOTE: The current implementation of crash tracking doesn't work with ancient version of bash
* that ships with OS X by default.
*/
@Test
void testOomeTracking() throws Exception {
Path script = tempDir.resolve("dd_oome_notifier." + getExtension());
Expand Down Expand Up @@ -281,9 +296,10 @@ void testOomeTracking() throws Exception {

assertNotEquals(0, p.waitFor(), "Application should have crashed");

assertTrue(
stderrStr.toString().contains("com.datadog.crashtracking.OOMENotifier - OOME event sent"));
assertTrue(stdoutStr.toString().contains("OOME Event generated successfully"));
assertThat(
stderrStr.toString(),
containsString("com.datadog.crashtracking.OOMENotifier - OOME event sent"));
assertThat(stdoutStr.toString(), containsString("OOME Event generated successfully"));
}

@Test
Expand Down Expand Up @@ -352,16 +368,16 @@ void testCombineTracking() throws Exception {
assertNotEquals(0, p.waitFor(), "Application should have crashed");

// Crash uploader did get triggered
assertTrue(stdoutStr.toString().contains(" was uploaded successfully"));
assertTrue(
stderrStr
.toString()
.contains(
"com.datadog.crashtracking.CrashUploader - Successfully uploaded the crash files"));
assertThat(stdoutStr.toString(), containsString(" was uploaded successfully"));
assertThat(
stderrStr.toString(),
containsString(
"com.datadog.crashtracking.CrashUploader - Successfully uploaded the crash files"));

// OOME notifier did get triggered
assertTrue(
stderrStr.toString().contains("com.datadog.crashtracking.OOMENotifier - OOME event sent"));
assertTrue(stdoutStr.toString().contains("OOME Event generated successfully"));
assertThat(
stderrStr.toString(),
containsString("com.datadog.crashtracking.OOMENotifier - OOME event sent"));
assertThat(stdoutStr.toString(), containsString("OOME Event generated successfully"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public final class CrashTrackingConfig {
public static final String CRASH_TRACKING_TAGS = "crashtracking.tags";

public static final String CRASH_TRACKING_UPLOAD_TIMEOUT = "crashtracking.upload.timeout";
public static final int CRASH_TRACKING_UPLOAD_TIMEOUT_DEFAULT = 30;
public static final int CRASH_TRACKING_UPLOAD_TIMEOUT_DEFAULT = 2;

public static final String CRASH_TRACKING_PROXY_HOST = "crashtracking.proxy.host";
public static final String CRASH_TRACKING_PROXY_PORT = "crashtracking.proxy.port";
Expand Down