|
1 | 1 | package datadog.smoketest;
|
2 | 2 |
|
| 3 | +import static org.hamcrest.CoreMatchers.containsString; |
| 4 | +import static org.hamcrest.MatcherAssert.assertThat; |
3 | 5 | import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
4 |
| -import static org.junit.jupiter.api.Assertions.assertTrue; |
5 | 6 | import static org.junit.jupiter.api.Assumptions.assumeFalse;
|
6 | 7 |
|
7 | 8 | import datadog.trace.api.Platform;
|
|
23 | 24 | import org.junit.jupiter.api.BeforeEach;
|
24 | 25 | import org.junit.jupiter.api.Test;
|
25 | 26 |
|
| 27 | +/* |
| 28 | + * NOTE: The current implementation of crash tracking doesn't work with ancient version of bash |
| 29 | + * that ships with OS X by default. |
| 30 | + */ |
26 | 31 | public class CrashtrackingSmokeTest {
|
27 | 32 | private MockWebServer tracingServer;
|
28 | 33 |
|
@@ -76,6 +81,10 @@ private static String getExtension() {
|
76 | 81 | return Platform.isWindows() ? "bat" : "sh";
|
77 | 82 | }
|
78 | 83 |
|
| 84 | + /* |
| 85 | + * NOTE: The current implementation of crash tracking doesn't work with ancient version of bash |
| 86 | + * that ships with OS X by default. |
| 87 | + */ |
79 | 88 | @Test
|
80 | 89 | void testCrashTracking() throws Exception {
|
81 | 90 | Path script = tempDir.resolve("dd_crash_uploader." + getExtension());
|
@@ -140,14 +149,17 @@ void testCrashTracking() throws Exception {
|
140 | 149 |
|
141 | 150 | assertNotEquals(0, p.waitFor(), "Application should have crashed");
|
142 | 151 |
|
143 |
| - assertTrue(stdoutStr.toString().contains(" was uploaded successfully")); |
144 |
| - assertTrue( |
145 |
| - stderrStr |
146 |
| - .toString() |
147 |
| - .contains( |
148 |
| - "com.datadog.crashtracking.CrashUploader - Successfully uploaded the crash files")); |
| 152 | + assertThat(stdoutStr.toString(), containsString(" was uploaded successfully")); |
| 153 | + assertThat( |
| 154 | + stderrStr.toString(), |
| 155 | + containsString( |
| 156 | + "com.datadog.crashtracking.CrashUploader - Successfully uploaded the crash files")); |
149 | 157 | }
|
150 | 158 |
|
| 159 | + /* |
| 160 | + * NOTE: The current implementation of crash tracking doesn't work with ancient version of bash |
| 161 | + * that ships with OS X by default. |
| 162 | + */ |
151 | 163 | @Test
|
152 | 164 | void testCrashTrackingLegacy() throws Exception {
|
153 | 165 | Path script = tempDir.resolve("dd_crash_uploader." + getExtension());
|
@@ -212,14 +224,17 @@ void testCrashTrackingLegacy() throws Exception {
|
212 | 224 |
|
213 | 225 | assertNotEquals(0, p.waitFor(), "Application should have crashed");
|
214 | 226 |
|
215 |
| - assertTrue(stdoutStr.toString().contains(" was uploaded successfully")); |
216 |
| - assertTrue( |
217 |
| - stderrStr |
218 |
| - .toString() |
219 |
| - .contains( |
220 |
| - "com.datadog.crashtracking.CrashUploader - Successfully uploaded the crash files")); |
| 227 | + assertThat(stdoutStr.toString(), containsString(" was uploaded successfully")); |
| 228 | + assertThat( |
| 229 | + stderrStr.toString(), |
| 230 | + containsString( |
| 231 | + "com.datadog.crashtracking.CrashUploader - Successfully uploaded the crash files")); |
221 | 232 | }
|
222 | 233 |
|
| 234 | + /* |
| 235 | + * NOTE: The current implementation of crash tracking doesn't work with ancient version of bash |
| 236 | + * that ships with OS X by default. |
| 237 | + */ |
223 | 238 | @Test
|
224 | 239 | void testOomeTracking() throws Exception {
|
225 | 240 | Path script = tempDir.resolve("dd_oome_notifier." + getExtension());
|
@@ -281,9 +296,10 @@ void testOomeTracking() throws Exception {
|
281 | 296 |
|
282 | 297 | assertNotEquals(0, p.waitFor(), "Application should have crashed");
|
283 | 298 |
|
284 |
| - assertTrue( |
285 |
| - stderrStr.toString().contains("com.datadog.crashtracking.OOMENotifier - OOME event sent")); |
286 |
| - assertTrue(stdoutStr.toString().contains("OOME Event generated successfully")); |
| 299 | + assertThat( |
| 300 | + stderrStr.toString(), |
| 301 | + containsString("com.datadog.crashtracking.OOMENotifier - OOME event sent")); |
| 302 | + assertThat(stdoutStr.toString(), containsString("OOME Event generated successfully")); |
287 | 303 | }
|
288 | 304 |
|
289 | 305 | @Test
|
@@ -352,16 +368,16 @@ void testCombineTracking() throws Exception {
|
352 | 368 | assertNotEquals(0, p.waitFor(), "Application should have crashed");
|
353 | 369 |
|
354 | 370 | // Crash uploader did get triggered
|
355 |
| - assertTrue(stdoutStr.toString().contains(" was uploaded successfully")); |
356 |
| - assertTrue( |
357 |
| - stderrStr |
358 |
| - .toString() |
359 |
| - .contains( |
360 |
| - "com.datadog.crashtracking.CrashUploader - Successfully uploaded the crash files")); |
| 371 | + assertThat(stdoutStr.toString(), containsString(" was uploaded successfully")); |
| 372 | + assertThat( |
| 373 | + stderrStr.toString(), |
| 374 | + containsString( |
| 375 | + "com.datadog.crashtracking.CrashUploader - Successfully uploaded the crash files")); |
361 | 376 |
|
362 | 377 | // OOME notifier did get triggered
|
363 |
| - assertTrue( |
364 |
| - stderrStr.toString().contains("com.datadog.crashtracking.OOMENotifier - OOME event sent")); |
365 |
| - assertTrue(stdoutStr.toString().contains("OOME Event generated successfully")); |
| 378 | + assertThat( |
| 379 | + stderrStr.toString(), |
| 380 | + containsString("com.datadog.crashtracking.OOMENotifier - OOME event sent")); |
| 381 | + assertThat(stdoutStr.toString(), containsString("OOME Event generated successfully")); |
366 | 382 | }
|
367 | 383 | }
|
0 commit comments