test(integration): fix flaky tests with root-cause changes - #2713
Conversation
PR SummaryLow Risk Overview Reviewed by Cursor Bugbot for commit 4a44dda. Bugbot is set up for automated code reviews on this repo. Configure here. |
❌ 4 Tests Failed:
View the full list of 8 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
Code Review
Using require assertions inside the Eventually block in team_metrics_test.go causes the test to terminate immediately on the first failure, which prevents the intended retry logic from executing. Replacing these assertions with conditional checks that return false ensures the loop continues until the timeout is reached.
14c86e9 to
af67a80
Compare
|
Plan Error |
af67a80 to
d214bac
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d214bac024
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
d214bac to
19b1199
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 19b11995bb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- TestTeamMetrics: Eventually returned on any metrics, but assertions required start-rate and concurrent-sandboxes signals that lag behind the first non-empty response (ClickHouse aggregation). Move the assertions inside the loop and bump the window to 60s. - TestUpdateNetworkConfig pause/resume subtests: firewall rule reapply on resume is async; a one-shot curl races it. New helper verifyConnectivityEventually polls connectivity checks for 30s. - TestBindLocalhost: fixed 5s sleep was insufficient for python's http.server to start under CI load. Replaced with WaitForStatus poll (now extended to 60s total so any caller starting a service has time to come up). - TestListDir: parent sandbox used the 30s default timeout, which expired while the four parallel subtests waited to be scheduled. Bumped to 120s. - TestSandboxMemoryIntegrity subtests: dd + pause/resume iterations routinely exceed the 30s default timeout (tmpfs_hash alone takes ~44s). Bumped all three subtests to 300s.
19b1199 to
4a44dda
Compare
Summary
Address 5 flaky integration tests that have been blocking PRs (50–77% flake rate in main per Codecov). Each fix is targeted at the actual root cause, not just a longer timeout.
Eventuallyreturned as soon as any metric existed, but the assertions requiredSandboxStartRate > 0andConcurrentSandboxes > 0, which lag behind first non-empty response due to ClickHouse aggregation. Moved the assertions inside the loop; bumped the window to 60s.verifyConnectivityEventuallyhelper polls connectivity checks for 30s.http.serverto start under CI load, producing 502s. Replaced withWaitForStatuspoll. Also extendedWaitForStatus's cap from 5s→60s so any caller starting an in-sandbox service has time to come up.ddof/dev/urandom+ pause/resume iterations routinely exceed the 30s default timeout (thetmpfs_hashsubtest alone runs ~44s). Bumped all three subtests to 300s.Note on TestUpdateNetworkConfig
Traced the resume path:
pool.Get → ConfigureInternetis synchronous before resume returns, so the firewall rule install itself is not async. The remaining flake is likely either in-VM warmup or a race I couldn't pin down without deeper investigation. TheEventuallyretry is defensive — open to a follow-up if a real bug is identified.