test: consolidate and prune implementation-coupled tests
This commit is contained in:
1 parent
a7288cc612
commit
ddd420cc21
4 files changed
+73
-262
No files matched your search
@@ -275,61 +275,3 @@ macro_rules! debug_eprintln {
|
||||
}
|
||||
|
||||
use debug_eprintln;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn startup_failure_details_include_bind_command_status_and_output() {
|
||||
let status = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg("exit 7")
|
||||
.status()
|
||||
.expect("shell exits");
|
||||
let failure = StartupFailure {
|
||||
bind: "127.0.0.1:12345".to_owned(),
|
||||
command: "\"irtt\" \"server\"".to_owned(),
|
||||
output: "stderr: listen udp4 127.0.0.1:12345: bind: address already in use".to_owned(),
|
||||
exit_status: Some(status),
|
||||
error: Some("readiness timed out or server exited before ready".to_owned()),
|
||||
};
|
||||
|
||||
let details = failure.details();
|
||||
|
||||
assert!(details.contains("bind: 127.0.0.1:12345"));
|
||||
assert!(details.contains("command: \"irtt\" \"server\""));
|
||||
assert!(details.contains("exit status:"));
|
||||
assert!(details.contains("address already in use"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn startup_failure_summary_includes_attempt_count_and_each_bind() {
|
||||
let failures = vec![
|
||||
StartupFailure {
|
||||
bind: "127.0.0.1:11111".to_owned(),
|
||||
command: "\"irtt\" \"server\" -b 127.0.0.1:11111".to_owned(),
|
||||
output: "stdout: first".to_owned(),
|
||||
exit_status: None,
|
||||
error: Some("readiness timed out or server exited before ready".to_owned()),
|
||||
},
|
||||
StartupFailure {
|
||||
bind: "127.0.0.1:22222".to_owned(),
|
||||
command: "\"irtt\" \"server\" -b 127.0.0.1:22222".to_owned(),
|
||||
output: "stderr: second".to_owned(),
|
||||
exit_status: None,
|
||||
error: Some("readiness timed out or server exited before ready".to_owned()),
|
||||
},
|
||||
];
|
||||
|
||||
let message = format_startup_failures("irtt", &failures);
|
||||
|
||||
assert!(message.contains("after 2 attempt(s)"));
|
||||
assert!(message.contains("attempt 1/2"));
|
||||
assert!(message.contains("attempt 2/2"));
|
||||
assert!(message.contains("127.0.0.1:11111"));
|
||||
assert!(message.contains("127.0.0.1:22222"));
|
||||
assert!(message.contains("stdout: first"));
|
||||
assert!(message.contains("stderr: second"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user