mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-11-16 17:09:09 +00:00
test(check): isolate the docs-counts infra verdict test from the tree
The release-mode infra tests ran the counts gate against the working tree. A real STRICT drift wins over the infrastructure verdict (exit 1 before exit 2), and since derived values are refreshed only at release, any feature branch that adds a migration or a provider carries such a drift by design. On #20271 (two new migrations) both tests failed with "expected exit 2 (infrastructure), got 1". Run the gate against an empty temp root, so the only failure left is the stubbed facts probe. The assertions are unchanged.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import { afterEach, describe, it } from "node:test";
|
||||
import { after, afterEach, describe, it } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import {
|
||||
buildChecks,
|
||||
runCountsGate,
|
||||
@@ -86,10 +89,18 @@ describe("readCodeFacts failure is reported as a strict failure", () => {
|
||||
// The gate itself no longer reports that failure as documentation drift: facts that cannot be
|
||||
// collected are an INFRASTRUCTURE failure (exit 2), so a host too loaded to run the tsx probe
|
||||
// can never be mistaken for docs that need editing.
|
||||
//
|
||||
// The gate runs against an empty root: a real STRICT drift still wins over the infrastructure
|
||||
// verdict (exit 1), and a feature branch that adds a migration or a provider carries such a
|
||||
// drift by design (derived values are refreshed at release). Against the working tree, these
|
||||
// assertions would depend on the branch they run on.
|
||||
const emptyRoot = fs.mkdtempSync(path.join(os.tmpdir(), "docs-counts-err-seam-"));
|
||||
after(() => fs.rmSync(emptyRoot, { recursive: true, force: true }));
|
||||
|
||||
describe("the release gate classifies a facts failure as infrastructure", () => {
|
||||
it("exits 2 with an infrastructure verdict, not a STRICT drift", () => {
|
||||
__setSpawnSyncForTest(failingProbe);
|
||||
const r = runCountsGate({ mode: "release" }) as GateResult;
|
||||
const r = runCountsGate({ mode: "release", root: emptyRoot }) as GateResult;
|
||||
assert.equal(r.mode, "release");
|
||||
assert.equal(r.exitCode, 2, `expected exit 2 (infrastructure), got ${r.exitCode}`);
|
||||
assert.ok(r.infra, "the result must carry the infrastructure failure");
|
||||
@@ -111,7 +122,7 @@ describe("the release gate classifies a facts failure as infrastructure", () =>
|
||||
signal: "SIGKILL",
|
||||
}) as never
|
||||
);
|
||||
const r = runCountsGate({ mode: "release" }) as GateResult;
|
||||
const r = runCountsGate({ mode: "release", root: emptyRoot }) as GateResult;
|
||||
assert.equal(r.exitCode, 2);
|
||||
assert.match(JSON.stringify(r.infra), /timeout/i);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user