test(team): stabilize windows launch matrix checks

This commit is contained in:
777genius 2026-04-27 12:21:22 +03:00
parent 11d5851953
commit 6707cc3b60

View file

@ -2124,7 +2124,7 @@ describe('Team agent launch matrix safe e2e', () => {
}, },
}, },
}); });
}); }, 120_000);
it('stopAllTeams stops in-flight mixed OpenCode secondary lanes for multiple teams', async () => { it('stopAllTeams stops in-flight mixed OpenCode secondary lanes for multiple teams', async () => {
const firstTeamName = 'mixed-opencode-stop-all-inflight-multi-a-safe-e2e'; const firstTeamName = 'mixed-opencode-stop-all-inflight-multi-a-safe-e2e';
@ -3702,6 +3702,11 @@ describe('Team agent launch matrix safe e2e', () => {
(svc as any).readProcessRssBytesByPid = async () => (svc as any).readProcessRssBytesByPid = async () =>
new Map([[sharedHostPid, 183.9 * 1024 * 1024]]); new Map([[sharedHostPid, 183.9 * 1024 * 1024]]);
await waitForCondition(async () => {
const snapshot = await svc.getTeamAgentRuntimeSnapshot(teamName);
return snapshot.members.bob?.alive === true;
});
const runtimeSnapshot = await svc.getTeamAgentRuntimeSnapshot(teamName); const runtimeSnapshot = await svc.getTeamAgentRuntimeSnapshot(teamName);
expect(runtimeSnapshot.members.bob).toMatchObject({ expect(runtimeSnapshot.members.bob).toMatchObject({
@ -16259,15 +16264,15 @@ class RejectingBlockingOpenCodeRuntimeAdapter extends FakeOpenCodeRuntimeAdapter
} }
} }
async function waitForCondition(assertion: () => boolean): Promise<void> { async function waitForCondition(assertion: () => boolean | Promise<boolean>): Promise<void> {
const startedAt = Date.now(); const startedAt = Date.now();
while (Date.now() - startedAt < 5_000) { while (Date.now() - startedAt < 5_000) {
if (assertion()) { if (await assertion()) {
return; return;
} }
await new Promise((resolve) => setTimeout(resolve, 10)); await new Promise((resolve) => setTimeout(resolve, 10));
} }
expect(assertion()).toBe(true); expect(await assertion()).toBe(true);
} }
async function removeTempDirWithRetries(dir: string): Promise<void> { async function removeTempDirWithRetries(dir: string): Promise<void> {