Wait for busy guest readiness before measuring shutdown grace
ci / check (push) Failing after 11m45s

This commit is contained in:
Sausage
2026-11-02 00:10:34 +00:00
parent facaf1d9b1
commit c7d478754d
2 changed files with 12 additions and 8 deletions
+9 -8
View File
@@ -1015,6 +1015,7 @@ async fn stop_deadlines() {
async fn shutdown_stops_busy_processes_in_parallel_after_five_seconds() {
let w = TestWorld::new();
let h = w.start().await;
let mut notifications = h.subscribe();
let mut tasks = Vec::new();
for _ in 0..2 {
@@ -1024,14 +1025,14 @@ async fn shutdown_stops_busy_processes_in_parallel_after_five_seconds() {
}));
}
tokio::time::timeout(std::time::Duration::from_secs(20), async {
while h
.processes()
.values()
.filter(|p| p.plugin == "probe" && p.method == "busy")
.count()
!= 2
{
tokio::task::yield_now().await;
// Admission precedes guest startup. Stopping at admission can close
// stdin before the guest receives its busy request, so there is then
// no busy work that needs the five-second kill budget.
let mut ready = 0;
while ready != tasks.len() {
if notifications.recv().await.unwrap()["params"]["name"] == "busy-ready" {
ready += 1;
}
}
})
.await
+3
View File
@@ -90,6 +90,9 @@ fn wait_eof(lines: &mut Lines) {
std::fs::write("/state/stopped", "yes").unwrap();
}
fn busy() -> Value {
send(json!({"jsonrpc":"2.0", "method":"core.notify", "params":{
"name":"busy-ready", "params":{}
}}));
loop {
std::hint::spin_loop();
}