test(kuna): assert probe and scan outcomes instead of elapsed-time bounds (#10954)

test(kuna): assert the probe and scan outcomes instead of elapsed-time bounds
This commit is contained in:
morluto authored and GitHub committed 2026-11-15 17:21:41 +08:00
1 parent d06f6ccb98
commit d87e2c2714
3 files changed
+5 -7

No files matched your search

@@ -295,7 +295,6 @@ it("parses cache, timeout and job settings at the configuration boundary", () =>
it("stops a version probe that ignores SIGTERM instead of waiting on it", async () => {
const root = await createTestTempDirectory("rea-kuna-probe-term-");
const kuna = await writeFakeKuna(root, { version: { ignoreTerm: true } });
const started = Date.now();
const result = await inspectKunaInstallation(
{ REA_KUNA_COMMAND: kuna },
@@ -310,11 +309,12 @@ it("stops a version probe that ignores SIGTERM instead of waiting on it", async
diagnostics: {
probe_failure_reason: "timeout",
deadline_ms: 4_000,
signal: "SIGKILL",
},
},
});
// The owned process-group stop is bounded and must not wait on inherited output forever.
expect(Date.now() - started).toBeLessThan(10_000);
// The stop escalated past the ignored SIGTERM; waiting on the probe instead
// would hang until the test deadline names it.
const pid = (await fakeKunaCalls(kuna))[0]?.pid ?? 0;
expect(() => process.kill(pid, 0)).toThrow();
});
@@ -209,7 +209,8 @@ it("stops Kuna at the first contradictory row instead of awaiting the rest", asy
);
const client = open();
try {
const started = Date.now();
// Awaiting the hung scan would end at the 60 s project deadline with a
// deadline error; only a stop at the rejected row reports the output.
expect(
await client.execute("search_strings", { pattern: "fixture" }),
).toMatchObject({
@@ -220,7 +221,6 @@ it("stops Kuna at the first contradictory row instead of awaiting the rest", asy
diagnostics: { producer_operation: "kuna:strings" },
},
});
expect(Date.now() - started).toBeLessThan(30_000);
await setFakeKunaBehavior(kuna, {});
expect((await run(client, "list_strings")).result).toHaveLength(2);
expect(await scans(kuna)).toHaveLength(2);
@@ -103,7 +103,6 @@ it.skipIf(process.platform === "win32")(
);
const launcher = makeLauncher();
const scope = new ArtifactResourceScope();
const startedAt = Date.now();
try {
const result = await inspectKunaInstallation(
{ REA_KUNA_COMMAND: executable },
@@ -136,7 +135,6 @@ it.skipIf(process.platform === "win32")(
});
await waitForFile(childStarted);
await waitForFile(parentExited);
expect(Date.now() - startedAt).toBeLessThan(7_000);
expect(scope.hasPending).toBe(false);
expect(launcher.groups).toHaveLength(1);
} finally {