Skip to content

armgit / herdr

Public Imported from GitHub
0

the runtime your coding agents live on

test: fix flaky pid file stability test

Ogulcan Celik6144aa218efc
diff --git a/tests/cli_wrapper.rs b/tests/cli_wrapper.rs
index 3f71d5d13..3f81b3713 100644
--- a/tests/cli_wrapper.rs
+++ b/tests/cli_wrapper.rs
@@ -243,7 +243,7 @@ fn wait_for_pid_file_errors_when_file_never_contains_pid() {
}
#[test]
-fn wait_for_pid_file_rejects_partial_write_race_until_stable_contents() {
+fn wait_for_pid_file_rejects_unparseable_partial_write_until_stable_contents() {
let base = unique_test_dir();
fs::create_dir_all(&base).unwrap();
let pid_file = base.join("partial-race.pid");
@@ -253,12 +253,10 @@ fn wait_for_pid_file_rejects_partial_write_race_until_stable_contents() {
let pid_file = pid_file.clone();
move || {
thread::sleep(Duration::from_millis(40));
- fs::write(&pid_file, "12").unwrap();
+ fs::write(&pid_file, "pid=").unwrap();
thread::sleep(Duration::from_millis(40));
- fs::write(&pid_file, "123").unwrap();
+ fs::write(&pid_file, "pid=424242").unwrap();
thread::sleep(Duration::from_millis(40));
- fs::write(&pid_file, "1234").unwrap();
- thread::sleep(Duration::from_millis(200));
fs::write(&pid_file, "424242\n").unwrap();
}
});