swarm-ui: let a paused schedule's fire now send its message as a broadcast
Fire now was disabled on a paused schedule because the controller fires nothing while it is paused. It is enabled now and, after a confirmation, sends the schedule's message to its agents through the broadcast route, leaving the schedule paused with its start unchanged. A toast says who got it, and the error banner names the agents that did not.
This commit is contained in:
parent
48ce818bb7
commit
09de25b0ed
1 changed files with 111 additions and 9 deletions
|
|
@ -1,7 +1,10 @@
|
|||
// The body of a schedule's "fire now". Run by `npm test`.
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { fireNowBody } from "../src/pages/schedules/ScheduleTypes.ts";
|
||||
import {
|
||||
fireNowBody,
|
||||
pausedFireOutcome,
|
||||
} from "../src/pages/schedules/ScheduleTypes.ts";
|
||||
|
||||
test("fire now moves the start to the current second", () => {
|
||||
assert.deepEqual(fireNowBody(1_700_000_123_456), {
|
||||
|
|
@ -12,3 +15,30 @@ test("fire now moves the start to the current second", () => {
|
|||
test("fire now sends nothing but the start", () => {
|
||||
assert.deepEqual(Object.keys(fireNowBody(0)), ["anchor_unix"]);
|
||||
});
|
||||
|
||||
test("a paused schedule's send says who got it", () => {
|
||||
assert.deepEqual(
|
||||
pausedFireOutcome("nightly", [{ agent: "iris", sent: true }]),
|
||||
{ ok: true, message: "sent nightly to iris" },
|
||||
);
|
||||
assert.deepEqual(
|
||||
pausedFireOutcome("nightly", [
|
||||
{ agent: "iris", sent: true },
|
||||
{ agent: "coder", sent: true },
|
||||
]),
|
||||
{ ok: true, message: "sent nightly to 2 agents" },
|
||||
);
|
||||
});
|
||||
|
||||
test("a paused schedule's send names the agents that did not get it", () => {
|
||||
const out = pausedFireOutcome("nightly", [
|
||||
{ agent: "iris", sent: true },
|
||||
{ agent: "coder", sent: false, reason: "not running" },
|
||||
{ agent: "gui", sent: false },
|
||||
]);
|
||||
assert.equal(out.ok, false);
|
||||
assert.equal(
|
||||
out.message,
|
||||
"nightly did not reach 2 of 3: coder (not running), gui",
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue