pause_hold: pin the undeclared-agent case and fix the test comment
This commit is contained in:
parent
e5c55257f8
commit
1042bf65db
1 changed files with 21 additions and 2 deletions
|
|
@ -109,8 +109,7 @@ mod tests {
|
||||||
assert_eq!(declared(&wanted, "atlas").await, Some(AgentState::Paused));
|
assert_eq!(declared(&wanted, "atlas").await, Some(AgentState::Paused));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An operator's `Offline` is not overruled by the agent's pause, and an
|
/// An operator's `Offline` is not overruled by the agent's pause.
|
||||||
/// agent no hive declares leaves the pause to be tried again.
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn only_an_agent_declared_up_is_paused() {
|
async fn only_an_agent_declared_up_is_paused() {
|
||||||
let nats = TestNats::start();
|
let nats = TestNats::start();
|
||||||
|
|
@ -130,4 +129,24 @@ mod tests {
|
||||||
assert_eq!(declared(&wanted, "atlas").await, Some(AgentState::Offline));
|
assert_eq!(declared(&wanted, "atlas").await, Some(AgentState::Offline));
|
||||||
assert!(login.unheld_pauses().is_empty(), "nothing left to hold");
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue