diff --git a/crates/xy/tests/restart_policy.rs b/crates/xy/tests/restart_policy.rs new file mode 100644 index 0000000..21ce924 --- /dev/null +++ b/crates/xy/tests/restart_policy.rs @@ -0,0 +1,22 @@ +mod common; +use common::*; + +#[tokio::test] +async fn restart_cap_marks_failed() { + let xy = xy_bin(); + let bad = exit_failure_bin(); + let mut h = Harness::new(); + h.write_server("flaky", bad.to_str().unwrap(), 19_010, "always"); + h.start_daemon(&xy).await; + + let mut saw_failed = false; + for _ in 0..60 { + let (_c, out, _e) = h.run_cli(&xy, &["list"]).await; + if out.contains("flaky") && out.contains("failed") { + saw_failed = true; + break; + } + tokio::time::sleep(std::time::Duration::from_millis(100)).await; + } + assert!(saw_failed, "flaky never reached failed state"); +}