Repository navigation
accounts: run DefaultAccountProvider session lookup retry tests in virtual time - #342248
Merged
Alexandru Dima (alexdima) merged 1 commit intoOct 17, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused test-only changes preserve assertions, restore timers reliably, and have no unresolved findings.
No open issues 🎉
What changed in this PR
Speeds up two DefaultAccountProvider tests by replacing real retry waits with fake time.
Changes:
- Adds a helper that advances fake timeouts incrementally and restores the clock.
- Applies the helper to two failed-session-lookup tests without changing assertions.
| File | Description |
|---|---|
| src/vs/workbench/services/accounts/test/browser/defaultAccount.test.ts | Fakes retry delays while avoiding the hourly account poll. |
Review effort: Balanced
…rtual time A failed session lookup is retried three times with 500ms delays, so these two tests spent about 1s each waiting in real time. Run each whole test in virtual time with `runWithFakedTimers`. Both tests drop from ~1-1.1s to a few ms. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Alexandru Dima (alexdima)
force-pushed
the
agents/test-perf-default-account-retries
branch
from
October 17, 2026 09:49
f8e04d3 to
a4df0c5
Compare
Alexandru Dima (alexdima)
marked this pull request as ready for review
October 17, 2026 15:12
Alexandru Dima (alexdima)
enabled auto-merge (squash)
October 17, 2026 15:12
Ladislau Szomoru (lszomoru)
approved these changes
Oct 17, 2026
Alexandru Dima (alexdima)
deleted the
agents/test-perf-default-account-retries
branch
October 17, 2026 15:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cc Anthony Kim (@anthonykim1)
A failed session lookup is retried three times with 500ms delays, so these two tests spent about 1s each waiting in real time. Run each whole test in virtual time with
runWithFakedTimers.Both tests drop from ~1-1.1s to a few ms.
After the test body finishes,
runWithFakedTimersalso runs the remaining virtual timers, which includesDefaultAccountProvider's hourly account poll. That now happens after the assertions, and a temporary trace confirmed it starts no further session lookups that could leak into later tests.Part of a series that speeds up unit tests waiting on real time, found from the slow tests in the Linux Electron unit test job. Each change is a separate PR so it can be reverted on its own. Test files only; no assertions changed.
How to test
Results on macOS, with only this commit applied on top of 832a728:
./scripts/test.sh --run src/vs/workbench/services/accounts/test/browser/defaultAccount.test.ts: 65 passing (3s)