hive-c0re/hivectl/hive-agent: pause as a job-queue DAG node (closes #3056)

This commit is contained in:
damocles 2026-08-11 21:59:25 +02:00 committed by mara
commit 20a7a21053
13 changed files with 316 additions and 27 deletions

View file

@ -1587,6 +1587,47 @@ fn graceful_stop_shape_signal_drain_reconcile() {
);
}
#[test]
fn pause_shape_signal_drain() {
let q = JobQueue::new(1);
insert(&q, |builder| {
power::pause_nodes(builder, &["agent-a".to_owned()]);
});
assert_eq!(
declared_shape(&q),
vec![
// Unlike the stop quiesce pair (which hangs under an existing
// `set_wanted` head), pausing has no natural parent to reuse, so
// this shape declares its own `AgentWindow` brace — the pair are
// plain siblings under it, not a signal-holds-the-lease-itself
// shape (that was tried first and rejected at insert: a child
// can't `after_ok` its own parent — see `pause_quiesce`'s doc
// comment for the exact error).
row("agent_window", None, &[]),
row("pause_signal", Some("agent_window"), &[]),
row(
"pause_drain",
Some("agent_window"),
&[("pause_signal", "done")]
),
]
);
assert_eq!(
declared_resources(&q, node_of(&q, "agent_window")),
vec![Resource::Agent("agent-a".to_owned())],
"the brace holds the lease for the whole pair"
);
assert_eq!(
[
declared_resources(&q, node_of(&q, "pause_signal")),
declared_resources(&q, node_of(&q, "pause_drain")),
],
[vec![], vec![]],
"the pause pair borrows the brace's lease and declares nothing itself \
same shape the stop quiesce pair uses"
);
}
#[test]
fn spawn_shape_provision_create_dropin_reconcile() {
let q = JobQueue::new(1);