Skip to content

Commit becb258

Browse files
committed
test(agent-core): give the sweep-resilience wait the full test budget
1 parent 9c5604d commit becb258

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

packages/agent-core/test/mcp/oauth-service.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,12 @@ async function deliverCallback(flow: BeginAuthorizationResult): Promise<void> {
158158
await response.text();
159159
}
160160

161-
async function waitFor(condition: () => boolean, description: string): Promise<void> {
162-
const deadline = Date.now() + 5000;
161+
async function waitFor(
162+
condition: () => boolean,
163+
description: string,
164+
timeoutMs = 5000,
165+
): Promise<void> {
166+
const deadline = Date.now() + timeoutMs;
163167
while (!condition()) {
164168
if (Date.now() > deadline) throw new Error(`timed out waiting for ${description}`);
165169
await new Promise((resolve) => setTimeout(resolve, 10));
@@ -618,9 +622,13 @@ describe('McpOAuthService sweepProactiveRefresh resilience', () => {
618622
await writeFile(join(fixture.storeDir, 'corrupt-meta.json'), '{not json', 'utf-8');
619623

620624
expect(() => fixture.service.sweepProactiveRefresh()).not.toThrow();
625+
// The immediate refresh spans two localhost HTTP round-trips plus token
626+
// writes; on a loaded CI runner that can outlast the default 5s budget
627+
// while staying well inside this test's own 15s timeout.
621628
await waitFor(
622629
() => authServer.counts.refresh === 1,
623630
'the swept credential to refresh immediately',
631+
12_000,
624632
);
625633
}, 15000);
626634
});

0 commit comments

Comments
 (0)