feat(test): own process startup and cleanup

This commit is contained in:
slhx agent
2026-07-13 10:18:01 +02:00
parent 6b4bb97aaa
commit 7259dd6e33
5 changed files with 108 additions and 28 deletions
+31
View File
@@ -0,0 +1,31 @@
use hemx_test::TestProcess;
use std::process::Command;
use std::time::Duration;
#[test]
fn process_harness_reports_early_exit_with_context() {
// req: test/019
let mut command = Command::new(std::env::current_exe().expect("current test executable"));
command
.arg("--exact")
.arg("helper_process_exits_successfully")
.arg("--nocapture");
let error = match TestProcess::start(
command,
"short-lived helper",
"127.0.0.1:9",
Duration::from_secs(2),
) {
Ok(_) => panic!("a process that exits before readiness must fail startup"),
Err(error) => error,
};
let message = error.to_string();
assert!(message.contains("short-lived helper"), "{message}");
assert!(message.contains("127.0.0.1:9"), "{message}");
assert!(message.contains("exited with"), "{message}");
}
#[test]
fn helper_process_exits_successfully() {}