hives report an agent being updated: its status shows updating from the update's stop until the container is back up
A hive marks an agent updating when StopForUpdate stops its running container and clears it when the tail Reconcile or Start settles it, success or failure. The flag rides in the agent status snapshot (absent when false, so older readers and documents are unchanged), the status publisher sends a change at once instead of at the next sweep, and the swarm UI card shows an updating badge.
This commit is contained in:
parent
ca1e25b21e
commit
748ef2da08
1 changed files with 227 additions and 12 deletions
|
|
@ -6,6 +6,7 @@ import { test } from "node:test";
|
|||
import {
|
||||
canTurnIntoCustom,
|
||||
hivePauseReason,
|
||||
isUpdating,
|
||||
showsLoginNeeded,
|
||||
} from "../src/agent/AgentTypes.ts";
|
||||
|
||||
|
|
@ -53,3 +54,19 @@ test("an agent its hive paused shows the reason, any other shows none", () => {
|
|||
assert.equal(hivePauseReason({ paused_by_hive: "" }), null);
|
||||
assert.equal(hivePauseReason({}), null);
|
||||
});
|
||||
|
||||
test("only a snapshot that says the hive is updating the agent shows the badge", () => {
|
||||
const snapshot = (updating) => ({
|
||||
snapshot: {
|
||||
status_text: null,
|
||||
status_set_at: null,
|
||||
running: false,
|
||||
updating,
|
||||
},
|
||||
});
|
||||
assert.equal(isUpdating(snapshot(true)), true);
|
||||
assert.equal(isUpdating(snapshot(false)), false);
|
||||
// A hive that does not publish the field, and an agent with no snapshot.
|
||||
assert.equal(isUpdating(snapshot(undefined)), false);
|
||||
assert.equal(isUpdating({ snapshot: null }), false);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue