Skip to content

Commit 05f0097

Browse files
authored
Try waiting on child process (#1343)
Try waiting on child process Co-authored-by: gyuheon.oh <gyuheon.oh@datadoghq.com>
1 parent 629bce0 commit 05f0097

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

bin_tests/tests/crashtracker_bin_test.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ fn crash_tracking_empty_endpoint() {
12631263
let socket_path = extend_path(fixtures.tmpdir.path(), "trace_agent.socket");
12641264
let listener = UnixListener::bind(&socket_path).unwrap();
12651265

1266-
process::Command::new(&fixtures.artifacts[&crashtracker_bin])
1266+
let mut child = process::Command::new(&fixtures.artifacts[&crashtracker_bin])
12671267
// empty url, endpoint will be set to none
12681268
.arg("")
12691269
.arg(fixtures.artifacts[&crashtracker_receiver].as_os_str())
@@ -1280,16 +1280,12 @@ fn crash_tracking_empty_endpoint() {
12801280
let (mut stream1, _) = listener.accept().unwrap();
12811281
let body1 = read_http_request_body(&mut stream1);
12821282

1283-
stream1
1284-
.write_all(b"HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n")
1285-
.unwrap();
1283+
let _ = stream1.write_all(b"HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n");
12861284

12871285
let (mut stream2, _) = listener.accept().unwrap();
12881286
let body2 = read_http_request_body(&mut stream2);
12891287

1290-
stream2
1291-
.write_all(b"HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n")
1292-
.unwrap();
1288+
let _ = stream2.write_all(b"HTTP/1.1 404\r\nContent-Length: 0\r\n\r\n");
12931289

12941290
for body in [body1, body2].iter() {
12951291
if body.contains("is_crash_ping:true") {
@@ -1298,6 +1294,8 @@ fn crash_tracking_empty_endpoint() {
12981294
assert_telemetry_message(body.as_bytes(), "null_deref");
12991295
}
13001296
}
1297+
1298+
let _ = child.wait();
13011299
}
13021300

13031301
fn read_http_request_body(stream: &mut impl Read) -> String {

0 commit comments

Comments
 (0)