forked from mtusi2026/mtusi2026lab7
Prepare verified laboratory 7 implementation and evidence
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
bun test v1.4.4 (38afee6c8)
|
||||
|
||||
student-tests/sealed-shutdown.test.ts:
|
||||
81 | test("fresh running processes with post-seal cause and exit prove all three shutdowns", async () => {
|
||||
82 | const f = fixture(),
|
||||
83 | r = await f.run();
|
||||
84 | expect(Object.keys(r.observed).sort()).toEqual([...sealedServices].sort());
|
||||
85 | expect(r.observed.worker?.event).toBe("secret_freshness_failed");
|
||||
86 | expect(f.calls.slice(0,2)).toEqual(["retain","seal"]);
|
||||
^
|
||||
error: expect(received).toEqual(expected)
|
||||
|
||||
[
|
||||
- "retain",
|
||||
"seal",
|
||||
+ "events",
|
||||
]
|
||||
|
||||
- Expected - 1
|
||||
+ Received + 1
|
||||
|
||||
at <anonymous> (/Users/rey/mtuci/vp/lab7/student-tests/sealed-shutdown.test.ts:86:30)
|
||||
(fail) fresh running processes with post-seal cause and exit prove all three shutdowns [2.12ms]
|
||||
84 | expect(Object.keys(r.observed).sort()).toEqual([...sealedServices].sort());
|
||||
85 | expect(r.observed.worker?.event).toBe("secret_freshness_failed");
|
||||
86 | expect(f.calls.slice(0,2)).toEqual(["retain","seal"]);
|
||||
87 | });
|
||||
88 | test("baseline retention failure prevents seal and preserves its original error",async()=>{
|
||||
89 | const f=fixture(),error=Error("FIXTURE_BASELINE_WRITE");f.ports.retainBaseline=async()=>{throw error;};let actual;try{await f.run();}catch(e){actual=e;}expect(actual).toBe(error);expect(f.calls).not.toContain("seal");
|
||||
^
|
||||
error: expect(received).toBe(expected)
|
||||
|
||||
Expected: 84 | expect(Object.keys(r.observed).sort()).toEqual([...sealedServices].sort());
|
||||
85 | expect(r.observed.worker?.event).toBe("secret_freshness_failed");
|
||||
86 | expect(f.calls.slice(0,2)).toEqual(["retain","seal"]);
|
||||
87 | });
|
||||
88 | test("baseline retention failure prevents seal and preserves its original error",async()=>{
|
||||
89 | const f=fixture(),error=Error("FIXTURE_BASELINE_WRITE");f.ports.retainBaseline=async()=>{throw error;};let actual;try{await f.run();}catch(e){actual=e;}expect(actual).toBe(error);expect(f.calls).not.toContain("seal");
|
||||
^
|
||||
error: FIXTURE_BASELINE_WRITE
|
||||
at <anonymous> (/Users/rey/mtuci/vp/lab7/student-tests/sealed-shutdown.test.ts:89:26)
|
||||
|
||||
Received: undefined
|
||||
|
||||
at <anonymous> (/Users/rey/mtuci/vp/lab7/student-tests/sealed-shutdown.test.ts:89:169)
|
||||
(fail) baseline retention failure prevents seal and preserves its original error [0.94ms]
|
||||
87 | });
|
||||
88 | test("baseline retention failure prevents seal and preserves its original error",async()=>{
|
||||
89 | const f=fixture(),error=Error("FIXTURE_BASELINE_WRITE");f.ports.retainBaseline=async()=>{throw error;};let actual;try{await f.run();}catch(e){actual=e;}expect(actual).toBe(error);expect(f.calls).not.toContain("seal");
|
||||
90 | });
|
||||
91 | test("recheck baseline freshness after diagnostic retention latency before dispatching seal",async()=>{
|
||||
92 | const f=fixture();f.ports.retainBaseline=async()=>{await f.ports.sleep(1001);};await expect(f.run()).rejects.toThrow("SEALED_BASELINE_NOT_FRESH");expect(f.calls).not.toContain("seal");
|
||||
^
|
||||
error: expect(received).rejects.toThrow(expected)
|
||||
|
||||
Expected promise that rejects
|
||||
Received promise that resolved: Promise { <resolved> }
|
||||
|
||||
at <anonymous> (/Users/rey/mtuci/vp/lab7/student-tests/sealed-shutdown.test.ts:92:111)
|
||||
(fail) recheck baseline freshness after diagnostic retention latency before dispatching seal [0.10ms]
|
||||
(pass) unrelated restart without freshness cause cannot pass sealed acceptance [0.07ms]
|
||||
(pass) old pre-seal events cannot explain a later unrelated restart [0.06ms]
|
||||
(pass) future cause events are not accepted [0.07ms]
|
||||
(pass) cause event alone does not prove process exit or restart [0.08ms]
|
||||
(pass) malformed baseline freshness fails before seal [0.08ms]
|
||||
(pass) future baseline freshness fails before seal [0.03ms]
|
||||
(pass) stale baseline freshness fails before seal [0.01ms]
|
||||
(pass) all baseline processes must be running before seal [0.04ms]
|
||||
(pass) freshness read I/O error preserves its primary identity and never seals [0.05ms]
|
||||
(pass) baseline ages are rechecked after reads immediately before sealing [0.03ms]
|
||||
(pass) a replaced container cannot satisfy the original process baseline [0.03ms]
|
||||
|
||||
11 pass
|
||||
3 fail
|
||||
22 expect() calls
|
||||
Ran 14 tests across 1 file. [12.00ms]
|
||||
Reference in New Issue
Block a user