[control] Tests: a 15 s trial margin and waits on state, not fixed sleeps, for a loaded runner
This commit is contained in:
@@ -237,10 +237,16 @@ mod unix {
|
||||
"{stage}: edge.json untouched"
|
||||
);
|
||||
}
|
||||
// A trial edge was serving reverts by itself at its deadline (watch 2 s + margin 5 s,
|
||||
// common/mod.rs: room for a loaded runner between the watch's end and the confirmation).
|
||||
tokio::time::sleep(Duration::from_secs(8)).await;
|
||||
let st = env.edge_status().await;
|
||||
// A trial edge was serving reverts by itself at its deadline (watch 2 s + margin 15 s,
|
||||
// common/mod.rs: room for a loaded runner between the trial's load and the confirmation).
|
||||
let deadline = std::time::Instant::now() + Duration::from_secs(30);
|
||||
let st = loop {
|
||||
let st = env.edge_status().await;
|
||||
if st["trial"].is_null() || std::time::Instant::now() > deadline {
|
||||
break st;
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(250)).await;
|
||||
};
|
||||
assert!(st["trial"].is_null(), "{stage}: trial still running: {st}");
|
||||
if !confirmed {
|
||||
assert_eq!(
|
||||
@@ -789,7 +795,23 @@ mod unix {
|
||||
)
|
||||
.await;
|
||||
let id = r.json["apply"]["id"].as_str().unwrap().to_owned();
|
||||
tokio::time::sleep(Duration::from_millis(1500)).await;
|
||||
// Edge goes once the trial is loaded and watched (a fixed 1.5 s was before the reload on
|
||||
// a loaded runner, layers run rja3pbbd14fk1).
|
||||
let deadline = std::time::Instant::now() + Duration::from_secs(20);
|
||||
loop {
|
||||
let s = env
|
||||
.call("GET", &format!("/api/v1/applies/{id}"), None)
|
||||
.await;
|
||||
if s.json["state"] == "watching" {
|
||||
break;
|
||||
}
|
||||
assert!(
|
||||
std::time::Instant::now() < deadline,
|
||||
"never watched: {}",
|
||||
s.text
|
||||
);
|
||||
tokio::time::sleep(Duration::from_millis(50)).await;
|
||||
}
|
||||
env.stop_edge();
|
||||
let rec = env.wait_apply(&id).await;
|
||||
assert_eq!(rec["state"], "needs_attention", "{rec}");
|
||||
|
||||
@@ -174,7 +174,10 @@ state_dir = "{state}"
|
||||
credentials_dir = "{creds}"
|
||||
watch_secs = {watch}
|
||||
watch_every_secs = 1
|
||||
trial_margin_secs = 5
|
||||
# Production: 30 s. Control starts its watch after the trial's journal is written, which took
|
||||
# over 5 s on the loaded shared runner (layers run rja3pbbd14fk1); edge's deadline counts from
|
||||
# the trial's load. The tests that wait out a deadline use this value (apply.rs, engine_switch.rs).
|
||||
trial_margin_secs = 15
|
||||
health_poll_secs = 1
|
||||
|
||||
[routes]
|
||||
|
||||
@@ -575,10 +575,10 @@ esac
|
||||
let st = ce.env.wait_control_exit(Duration::from_secs(30));
|
||||
eprintln!("QC control exit: {st:?}");
|
||||
assert!(st.is_some());
|
||||
// Longer than edge's trial deadline would allow.
|
||||
tokio::time::sleep(Duration::from_secs(15)).await;
|
||||
// Past the Caddy guard's deadline: watch 2 s + margin 15 s (common/mod.rs) + 5 s.
|
||||
tokio::time::sleep(Duration::from_secs(27)).await;
|
||||
let during = visit(&ce.env, ce.https, "b.test").await;
|
||||
eprintln!("QC b.test through Caddy 15 s after the crash, control down: {during}");
|
||||
eprintln!("QC b.test through Caddy 27 s after the crash, control down: {during}");
|
||||
ce.env.start_control(None);
|
||||
tokio::time::sleep(Duration::from_secs(3)).await;
|
||||
let after = visit(&ce.env, ce.https, "b.test").await;
|
||||
|
||||
Reference in New Issue
Block a user