mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-20 15:19:16 +00:00
* feat(plugins): add isolated plugin host runtime * test(plugins): build runtime dependencies before tests * fix(plugins): harden runtime lifecycle and recovery * fix(plugins): harden runtime extension boundaries * fix(plugins): enforce runtime integrity boundaries * fix(plugins): await utility process exit * fix(plugins): harden utility process containment * fix(plugins): close runtime recovery gaps * fix(plugins): harden runtime lifecycle boundaries
27 lines
941 B
JavaScript
27 lines
941 B
JavaScript
"use strict";
|
|
|
|
const assert = require("node:assert/strict");
|
|
const test = require("node:test");
|
|
|
|
const {
|
|
registerPluginShutdown,
|
|
resetPluginShutdownForTests,
|
|
runPluginShutdown,
|
|
} = require("./shutdownCoordinator.cjs");
|
|
|
|
test("plugin shutdown is idempotent and completes before its quit deadline", async (context) => {
|
|
context.after(resetPluginShutdownForTests);
|
|
let calls = 0;
|
|
registerPluginShutdown(async () => { calls += 1; });
|
|
const [first, second] = await Promise.all([runPluginShutdown(), runPluginShutdown()]);
|
|
assert.deepEqual(first, { timedOut: false });
|
|
assert.deepEqual(second, { timedOut: false });
|
|
assert.equal(calls, 1);
|
|
});
|
|
|
|
test("plugin shutdown fails open after the bounded quit deadline", async (context) => {
|
|
context.after(resetPluginShutdownForTests);
|
|
registerPluginShutdown(async () => new Promise(() => {}));
|
|
assert.deepEqual(await runPluginShutdown({ timeoutMs: 5 }), { timedOut: true });
|
|
});
|