Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -53,8 +53,8 @@ describe("worker health handler", () => {
test("/readyz returns 200 when both probes succeed", async () => {
const handler = createWorkerHealthHandler({
redisProbe: async () => ({ ok: true } as const),
databaseProbe: async () => ({ ok: true } as const),
redisProbe: async () => ({ ok: true }) as const,
databaseProbe: async () => ({ ok: true }) as const,
workerGroup: "mail",
});
const { res, captured } = createMockResponse();
@@ -68,10 +68,27 @@ describe("worker health handler", () => {
expect(body.checks).toEqual({ redis: "ok", database: "ok" });
});
test("/readyz clears timeout timers after fast probes complete", async () => {
vi.useFakeTimers();
try {
const handler = createWorkerHealthHandler({
redisProbe: async () => ({ ok: true }) as const,
databaseProbe: async () => ({ ok: true }) as const,
});
const { res } = createMockResponse();
await handler(createMockReq("/readyz"), res);
expect(vi.getTimerCount()).toBe(0);
} finally {
vi.useRealTimers();
}
});
test("/readyz returns 503 when redis probe fails", async () => {
const handler = createWorkerHealthHandler({
redisProbe: async () => ({ ok: false, error: "ECONNREFUSED" } as const),
databaseProbe: async () => ({ ok: true } as const),
redisProbe: async () => ({ ok: false, error: "ECONNREFUSED" }) as const,
databaseProbe: async () => ({ ok: true }) as const,
});
const { res, captured } = createMockResponse();
@@ -86,7 +103,7 @@ describe("worker health handler", () => {
test("/readyz returns 503 when database probe throws", async () => {
const handler = createWorkerHealthHandler({
redisProbe: async () => ({ ok: true } as const),
redisProbe: async () => ({ ok: true }) as const,
databaseProbe: async () => {
throw new Error("pg disconnected");
},
@@ -101,11 +118,11 @@ describe("worker health handler", () => {
test("/readyz includes required runtime probes in readiness status", async () => {
const handler = createWorkerHealthHandler({
redisProbe: async () => ({ ok: true } as const),
databaseProbe: async () => ({ ok: true } as const),
redisProbe: async () => ({ ok: true }) as const,
databaseProbe: async () => ({ ok: true }) as const,
readinessProbes: {
outboxDispatcher: async () => ({ ok: true } as const),
workflowTrigger: async () => ({ ok: false, error: "subscriber disabled" } as const),
outboxDispatcher: async () => ({ ok: true }) as const,
workflowTrigger: async () => ({ ok: false, error: "subscriber disabled" }) as const,
},
workerGroup: "general",
});
@@ -129,7 +146,7 @@ describe("worker health handler", () => {
test("/readyz times out a hanging probe", async () => {
const handler = createWorkerHealthHandler({
redisProbe: () => new Promise(() => undefined),
databaseProbe: async () => ({ ok: true } as const),
databaseProbe: async () => ({ ok: true }) as const,
probeTimeoutMs: 20,
});
const { res, captured } = createMockResponse();
@@ -142,8 +159,8 @@ describe("worker health handler", () => {
test("unknown routes return 404 JSON", async () => {
const handler = createWorkerHealthHandler({
redisProbe: async () => ({ ok: true } as const),
databaseProbe: async () => ({ ok: true } as const),
redisProbe: async () => ({ ok: true }) as const,
databaseProbe: async () => ({ ok: true }) as const,
});
const { res, captured } = createMockResponse();
@@ -155,8 +172,8 @@ describe("worker health handler", () => {
test("/healthz omits workerGroup when none is configured", async () => {
const handler = createWorkerHealthHandler({
redisProbe: async () => ({ ok: true } as const),
databaseProbe: async () => ({ ok: true } as const),
redisProbe: async () => ({ ok: true }) as const,
databaseProbe: async () => ({ ok: true }) as const,
});
const { res, captured } = createMockResponse();