Skip to content

Commit 6ec6ffc

Browse files
committed
test(app-server): tolerate a thrown CIM deadline in the live enumeration test
The live PowerShell enumeration test already tolerated one transient empty result, but on a sufficiently contended windows-latest runner execFileSync's 8s production deadline fires instead and the error propagates by design — that throw was not tolerated, flaking the job. Catch it the same way and add a third attempt with a longer settle; production behavior is unchanged.
1 parent 80c49cf commit 6ec6ffc

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

tests/codex-app-server-processes.test.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,13 +457,26 @@ describe("Windows Win32_Process owner enumeration (#476)", () => {
457457
expect(child.pid).toBeGreaterThan(1);
458458
// Brief settle so Win32_Process can observe the child. A loaded Windows
459459
// runner can also exhaust one CIM enumeration deadline, so tolerate one
460-
// transient empty result while keeping the production timeout unchanged.
460+
// transient empty result OR one thrown deadline (ETIMEDOUT propagates by
461+
// design) while keeping the production timeout unchanged.
461462
Bun.sleepSync(250);
462-
let snapshots = listWindowsSnapshots();
463+
const enumerate = (): ReturnType<typeof listWindowsSnapshots> | undefined => {
464+
try {
465+
return listWindowsSnapshots();
466+
} catch {
467+
return undefined; // transient CIM deadline on a contended runner
468+
}
469+
};
470+
let snapshots = enumerate() ?? [];
463471
let match = snapshots.find(snapshot => snapshot.pid === child.pid);
464472
if (!match) {
465473
Bun.sleepSync(250);
466-
snapshots = listWindowsSnapshots();
474+
snapshots = enumerate() ?? [];
475+
match = snapshots.find(snapshot => snapshot.pid === child.pid);
476+
}
477+
if (!match) {
478+
Bun.sleepSync(1_000);
479+
snapshots = enumerate() ?? [];
467480
match = snapshots.find(snapshot => snapshot.pid === child.pid);
468481
}
469482
expect(match).toBeDefined();

0 commit comments

Comments
 (0)