Files
reverse-engineering-anything/tests/acceptance/pcapVerifier.test.ts
T
morluto 60149282fc test: strengthen integration oracles and verification (#8295)
* test: strengthen integration oracles and verification

* test: bound lifecycle gates and strengthen workflow checks

* test: verify complete paged and extracted results

* test: preserve bytecode and cancellation evidence

* test: strengthen retained evidence and fixture cleanup

* test: require cross-projection bridge identities

* test: retain fixture owners through cleanup failures

* test: verify graph examples and project selectors

* test: tighten provider and lifecycle regressions

* test: consolidate hex coverage and bound cutter cleanup

* test: bound subprocess output waits and strengthen graph checks

* test: check mcp recovery and preserve cleanup owners

* test: verify structured mcp argument failures

* test: preserve artifact cleanup and gdb limit evidence

* test: preserve evidence identities and bound provider gates

* test: retain browser and comparison cleanup owners

* test: bound startup and strengthen fixture oracles

* test: bound lifecycle gates and verify recovered evidence

* test: verify public outcomes and lifecycle ownership

* test: assert precise evidence and release lifecycle gates

* test: verify selected facts and bound cleanup waits

* test: check retained evidence and decoded records

* test: verify final reports and retain cleanup ownership

* test: bound reviewed startup gates and retain cleanup

* test: verify PE errors and preserve MCP cleanup

* test: preserve MCP fixture cleanup ownership

* test: release provider gates before late startup
2026-11-01 00:15:28 +08:00

63 lines
2.1 KiB
TypeScript

import { execFile } from "node:child_process";
import { existsSync } from "node:fs";
import { writeFile } from "node:fs/promises";
import { join } from "node:path";
import { promisify } from "node:util";
import { expect, it } from "vitest";
import { parseEvidence } from "../../src/domain/evidence.js";
import { pcapResultSchemas } from "../../src/domain/pcap/pcapAnalysis.js";
import { offlineHttpCapture } from "../fixtures/pcap/offlineHttpCapture.js";
import { createTestTempDirectory } from "../fixtures/temporaryDirectory.js";
const execute = promisify(execFile);
it.skipIf(
process.platform !== "linux" ||
!existsSync("/usr/bin/tshark") ||
!existsSync("/usr/bin/capinfos"),
)(
"verifies complete and unresolved HTTP coverage with real Wireshark tools",
async () => {
const root = await createTestTempDirectory("rea-pcap-verifier-test-");
const capture = join(root, "capture.pcap");
for (const unresolved of [false, true]) {
await writeFile(
capture,
offlineHttpCapture(
"/without-host",
1,
unresolved ? null : "example.test",
),
);
const environment = {
...process.env,
REA_TSHARK_COMMAND: "/usr/bin/tshark",
REA_CAPINFOS_COMMAND: "/usr/bin/capinfos",
};
const cli = await execute(
process.execPath,
["scripts/rea.mjs", "inspect-pcap-capture", capture, "--json"],
{ env: environment, timeout: 60_000, maxBuffer: 8 * 1024 * 1024 },
);
const result = pcapResultSchemas.inspect_pcap_capture.parse(
parseEvidence(JSON.parse(cli.stdout)).normalized_result,
);
expect(result.coverage).toBe(unresolved ? "partial" : "complete");
expect(result.http_request_uri_count).toBe(unresolved ? 0 : 1);
expect(result.http_request_uris).toEqual(
unresolved ? [] : ["http://example.test/without-host"],
);
await execute(
process.execPath,
["scripts/verify-pcap.mjs", "--pcap", capture],
{
env: environment,
timeout: 60_000,
maxBuffer: 8 * 1024 * 1024,
},
);
}
},
120_000,
);