Watch
0
0
Fork
You've already forked hyperhive
0

pause_hold: pin the undeclared-agent case and fix the test comment

This commit is contained in:
atlas 2026-11-09 23:40:38 +01:00 • committed by mara
commit 1042bf65db

View file

@ -109,8 +109,7 @@ mod tests {
assert_eq!(declared(&wanted, "atlas").await, Some(AgentState::Paused));
}
/// An operator's `Offline` is not overruled by the agent's pause, and an
/// agent no hive declares leaves the pause to be tried again.
/// An operator's `Offline` is not overruled by the agent's pause.
#[tokio::test]
async fn only_an_agent_declared_up_is_paused() {
let nats = TestNats::start();
@ -130,4 +129,24 @@ mod tests {
assert_eq!(declared(&wanted, "atlas").await, Some(AgentState::Offline));
assert!(login.unheld_pauses().is_empty(), "nothing left to hold");
}
/// An agent no hive declares has nothing to override: its pause is held at
/// once and nothing is written to any declaration.
#[tokio::test]
async fn an_undeclared_agent_is_held_at_once_and_nothing_is_declared() {
let nats = TestNats::start();
let wanted = WantedWriter::new(nats.client().await);
let hives = vec!["pr1ma".to_owned()];
let login = Reported::default();
login.record(
&swarm_queue_client::agent_state_subject("atlas"),
&header(Some("skipped get_loose_ends")),
);
assert_eq!(login.unheld_pauses(), ["atlas"], "control: pending first");
hold_pending(&login, &wanted, &hives).await;
assert!(login.unheld_pauses().is_empty(), "held at once");
assert_eq!(declared(&wanted, "atlas").await, None);
assert!(wanted.view("pr1ma").await.unwrap().is_none());
}
}