forked from mtusi2026/mtusi2026lab7
Prepare verified laboratory 7 implementation and evidence
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
bun test v1.4.4 (38afee6c8)
|
||||
|
||||
student-tests/health-convergence.test.ts:
|
||||
1 | import { test, expect } from "bun:test";
|
||||
2 | import { createHealthConvergence, freshSecretsAfterSeal } from "../scripts/health-convergence";
|
||||
3 | test("all three native Agent renders must be fresh after seal, including worker",()=>{
|
||||
4 | const now=Date.parse('2026-11-16T12:00:00Z'),fresh=new Date(now-1000).toISOString();expect(freshSecretsAfterSeal([fresh,fresh,fresh],now-10000,now,120000)).toBe(true);expect(freshSecretsAfterSeal([fresh,fresh,new Date(now-11000).toISOString()],now-10000,now,120000)).toBe(false);
|
||||
^
|
||||
error: expect(received).toBe(expected)
|
||||
|
||||
Expected: true
|
||||
Received: false
|
||||
|
||||
at <anonymous> (/Users/rey/mtuci/vp/lab7/student-tests/health-convergence.test.ts:4:158)
|
||||
(fail) all three native Agent renders must be fresh after seal, including worker [0.17ms]
|
||||
(pass) malformed, future or oversized render fails closed: invalid [0.01ms]
|
||||
(pass) malformed, future or oversized render fails closed: 2026-11-16T12:00:00.001Z [0.01ms]
|
||||
(pass) malformed, future or oversized render fails closed: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
33 | if (!["healthy", "starting", "unhealthy"].includes(state))
|
||||
34 | throw Error("BAO_HEALTH_INVALID");
|
||||
35 | if (state === "healthy" && elapsedMilliseconds <= budgetMilliseconds)
|
||||
36 | return { elapsedMilliseconds, reads };
|
||||
37 | if (elapsedMilliseconds >= budgetMilliseconds)
|
||||
38 | throw Error("BAO_HEALTH_NOT_CONVERGED");
|
||||
^
|
||||
error: BAO_HEALTH_NOT_CONVERGED
|
||||
at <anonymous> (/Users/rey/mtuci/vp/lab7/scripts/health-convergence.ts:38:15)
|
||||
at async <anonymous> (/Users/rey/mtuci/vp/lab7/student-tests/health-convergence.test.ts:9:322)
|
||||
(fail) bounded recovery waits for the actual worker render, not only API readiness [0.38ms]
|
||||
(pass) wait for the next healthy tick after unseal instead of trusting stale unhealthy [0.08ms]
|
||||
(pass) healthy container returns immediately without delaying recovery [0.03ms]
|
||||
(pass) never healthy fails at the bounded deadline [0.04ms]
|
||||
(pass) native read failure preserves its original identity [0.05ms]
|
||||
(pass) unknown state fails closed [0.02ms]
|
||||
(pass) backward clock is rejected [0.03ms]
|
||||
(pass) explicit ports are required [0.01ms]
|
||||
|
||||
10 pass
|
||||
2 fail
|
||||
14 expect() calls
|
||||
Ran 12 tests across 1 file. [12.00ms]
|
||||
Reference in New Issue
Block a user