Skip to content

Commit 6d9590f

Browse files
committed
test: remove remaining CI timing races
1 parent 447bc9f commit 6d9590f

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎src/audit/audit-event-writer.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ describe("audit event worker", () => {
421421
});
422422
} finally {
423423
clearSink();
424+
await writer.ready;
424425
await writer.stop();
425426
}
426427

@@ -630,6 +631,7 @@ describe("audit event worker", () => {
630631
const schemaStartedAt = performance.now();
631632
expect(schemaWriter.recordExecutionIdentity(captureWork(envelope))).toBe(true);
632633
expect(performance.now() - schemaStartedAt).toBeLessThan(250);
634+
await schemaWriter.ready;
633635
await schemaWriter.stop();
634636
expect(schemaErrors).toContain("audit execution identity persistence failed");
635637

@@ -663,6 +665,7 @@ describe("audit event worker", () => {
663665
const insertStartedAt = performance.now();
664666
expect(insertWriter.recordExecutionIdentity(captureWork(envelope))).toBe(true);
665667
expect(performance.now() - insertStartedAt).toBeLessThan(250);
668+
await insertWriter.ready;
666669
await insertWriter.stop();
667670
expect(insertErrors).toContain("audit execution identity persistence failed");
668671
expect(JSON.stringify(insertErrors)).not.toContain("raw-trigger-secret");
@@ -742,6 +745,7 @@ describe("audit event worker", () => {
742745
),
743746
),
744747
).toBe(true);
748+
await writer.ready;
745749
await writer.stop();
746750
expect(errors).toContain("audit execution identity envelope could not be queued");
747751
expect(errors).toContain("audit execution identity envelope rejected");

‎src/infra/advertised-lan-host.windows.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import type { NetworkInterfacesSnapshot } from "./network-interfaces.js";
66

77
type ResolveOptions = NonNullable<Parameters<typeof resolveAdvertisedLanHostCore>[0]>;
88
type RouteRunner = NonNullable<ResolveOptions["runCommandWithTimeout"]>;
9+
// This native probe validates PowerShell encoding, not the product's optional route-hint latency budget.
10+
const POWERSHELL_ENCODING_PROBE_TIMEOUT_MS = 10_000;
911

1012
function ipv4(address: string) {
1113
return {
@@ -48,7 +50,7 @@ describe.runIf(process.platform === "win32")("advertised LAN host PowerShell con
4850
"-Command",
4951
`[Console]::OutputEncoding=[Text.Encoding]::GetEncoding(437); ${outputPrefix}[pscustomobject]@{InterfaceAlias='réseau-网卡';RouteMetric=1;InterfaceMetric=1} | ConvertTo-Json -Compress`,
5052
],
51-
{ timeoutMs: 3_000, maxOutputBytes: 16 * 1024 },
53+
{ timeoutMs: POWERSHELL_ENCODING_PROBE_TIMEOUT_MS, maxOutputBytes: 16 * 1024 },
5254
);
5355
expect(result).toMatchObject({ code: 0 });
5456
expect(JSON.parse(result.stdout)).toMatchObject({ InterfaceAlias: "réseau-网卡" });

0 commit comments

Comments
 (0)