[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}");
|
||||
|
||||
Reference in New Issue
Block a user