feat(test): own process startup and cleanup
This commit is contained in:
@@ -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() {}
|
||||
Reference in New Issue
Block a user