Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/daemon/gateway-fleet.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ describe("gateway fleet smoke (ADR 0005 §35)", () => {
readonly npm?: NpmCli;
/** why: a worker that runs a real command runs it in its lease folder, which has to exist on disk. */
readonly realFilesystem?: boolean;
/** why: holds the gateway's first catalog read open, so a view shows `connected` before it lists the worker's model. */
readonly catalogLatencyMs?: number;
}): Promise<{ daemon: DaemonServer; filesystem: Filesystem; directory: string }> {
const directory =
options.existing?.directory ??
Expand All @@ -247,6 +249,9 @@ describe("gateway fleet smoke (ADR 0005 §35)", () => {
}),
clock: new SystemClock(),
knownModels: [options.model],
...(options.catalogLatencyMs === undefined
? {}
: { latencyMs: { listCatalog: options.catalogLatencyMs } }),
platform: "android",
});
options.onDriver?.(driver);
Expand Down Expand Up @@ -662,13 +667,17 @@ describe("gateway fleet smoke (ADR 0005 §35)", () => {
stdout: "hello-from-b",
gatewayUrl: restartGatewayUrl(),
existing: { directory: workerB.directory, filesystem: workerB.filesystem },
// why: #1628: the catalog lands after `connected` and `drained`; held here so the wait below must cover it on every run.
catalogLatencyMs: 1_000,
});
await vi.waitFor(
async () => {
const { workers } = await restartedGateway.dispatch("worker.list", {}, adminSession());
const view = workers.find((worker) => worker.id === workerBId);
expect(view?.connection).toBe("connected");
expect(view?.drained).toBe(true);
// why: `connected` and `drained` show before the catalog read lands; a fresh gateway has no older catalog, so routing answers UNKNOWN_MODEL until then.
expect(view?.catalog?.some((entry) => entry.models.includes("Pixel-B"))).toBe(true);
},
{ timeout: 15_000 },
);
Expand Down
Loading