-
Notifications
You must be signed in to change notification settings - Fork 729
ci(tests): scale timing watchdogs and per-test timeout for loaded CI runners #1600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
053a034
ci(tests): scale timing watchdogs and per-test timeout for loaded CI …
lidge-jun c9f3611
test(ci): pin the macOS lane's 20s per-test ceiling in the workflow c…
lidge-jun 12c4fe6
test(ci): raise CI watchdog floor to 30s and lane per-test timeout to…
lidge-jun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /** | ||
| * CI-scaled test watchdogs. | ||
| * | ||
| * Several tests race a real local server round-trip against a short in-test | ||
| * watchdog (`setTimeout(..., reject)`). Locally 1-2 s is generous, but the | ||
| * unsharded GitHub macOS runner runs the whole suite in one pool under heavy | ||
| * CPU contention and these watchdogs were the recurring flake class there | ||
| * (server-auth WS terminal 1 s, provider-option fixture WS 2 s, …). Observed | ||
| * runner stalls exceed 10 s on that lane (a 10 s-floor watchdog fired at | ||
| * 10.16 s), so the CI floor is 30 s: the watchdog exists to bound a genuinely | ||
| * hung test, not to assert latency. Local behaviour is unchanged. Bun's own | ||
| * per-test timeout (`--timeout`, 60 s on CI) would pre-empt a 30 s watchdog, | ||
| * so the lane timeout and this floor move together. | ||
| */ | ||
| export function watchdogMs(base: number): number { | ||
| return process.env.CI === "true" ? Math.max(base, 30_000) : base; | ||
| } | ||
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 26952
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 10138
🌐 Web query:
Bun test --timeout per-test timeout documentation💡 Result:
In Bun, you can manage test timeouts at either the global level (via the command line) or the individual test level (within your code). The default timeout for all tests is 5000 milliseconds (5 seconds) [1][2][3]. Global Timeout To set a timeout globally for all tests in a run, use the --timeout flag followed by the time in milliseconds [1][2][4]. bun test --timeout 10000 # Sets a 10-second timeout for all tests Per-Test Timeout To override the default timeout for a specific test, you can pass the timeout value (in milliseconds) as the third argument to the test function [2][3]. import { test, expect } from "bun:test"; // This test will fail if it takes longer than 1 second test("my test", => { expect(1 + 1).toBe(2); }, 1000); Alternatively, you can provide an object as the third argument containing the timeout option [5]: test("my test", => { expect(1 + 1).toBe(2); }, { timeout: 1000 }); Disabling Timeout To disable the timeout for a specific test, set the timeout value to 0 or Infinity [2]. test("infinite test", async => { await someVeryLongOperation; }, 0);
Citations:
Correct the timeout-ordering explanation in
tests/helpers/ci-watchdog.ts:11-13.--timeout 60000exceeds the 30,000 ms CI watchdog floor. The watchdog fires first, and Bun’s timeout is the outer backstop. The previous 20,000 ms timeout would have fired first.🤖 Prompt for AI Agents