-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Run tests with gotestsum #19076
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
Run tests with gotestsum #19076
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #19076 +/- ##
==========================================
- Coverage 69.89% 69.89% -0.01%
==========================================
Files 1612 1613 +1
Lines 215826 216019 +193
==========================================
+ Hits 150857 150989 +132
- Misses 64969 65030 +61 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
60f77d1 to
e201c50
Compare
Switch unit tests to use gotestsum. gotestsum has a few benefits, namely prettier output, built-in junit report generation, and automatic retries (individual tests, rather than full packages as some of our test infra does). Signed-off-by: Mohamed Hamza <[email protected]>
|
What do you think about adding the output of |
Good call! |
Signed-off-by: Mohamed Hamza <[email protected]>
Signed-off-by: Mohamed Hamza <[email protected]>
|
Here's an example: https://github.com/vitessio/vitess/actions/runs/20826216650/attempts/1#summary-59828106838. Default is all tests >100ms. We have a gazillion, so changing to top 20. |
Signed-off-by: Mohamed Hamza <[email protected]>
Signed-off-by: Mohamed Hamza <[email protected]>
Saving some time on some slow tests using [synctest](https://pkg.go.dev/testing/synctest). Slow tests pulled from changes in vitessio#19076. Before: ``` Signed-off-by: Mohamed Hamza <[email protected]> --- PASS: TestSleepTablet (15.01s) --- PASS: TestSleepTablet/default_sleep_duration (15.00s) --- PASS: TestEmergencyReparentShardSlow (0.00s) --- PASS: TestEmergencyReparentShardSlow/nil_WaitReplicasTimeout_and_request_takes_29_seconds_is_ok (29.00s) --- PASS: TestEmergencyReparentShardSlow/nil_WaitReplicasTimeout_and_request_takes_31_seconds_is_error (30.00s) --- PASS: TestPlannedReparentShardSlow (0.00s) --- PASS: TestPlannedReparentShardSlow/nil_WaitReplicasTimeout_and_request_takes_29_seconds_is_ok (28.01s) --- PASS: TestPlannedReparentShardSlow/nil_WaitReplicasTimeout_and_request_takes_31_seconds_is_error (30.00s) ok vitess.io/vitess/go/vt/vtctl/grpcvtctldserver 30.854s ``` After: ``` --- PASS: TestSleepTablet (0.00s) --- PASS: TestSleepTablet/default_sleep_duration (0.00s) --- PASS: TestEmergencyReparentShardSlow (0.00s) --- PASS: TestEmergencyReparentShardSlow/nil_WaitReplicasTimeout_and_request_takes_29_seconds_is_ok (0.01s) --- PASS: TestEmergencyReparentShardSlow/nil_WaitReplicasTimeout_and_request_takes_31_seconds_is_error (0.00s) --- PASS: TestPlannedReparentShardSlow (0.00s) --- PASS: TestPlannedReparentShardSlow/nil_WaitReplicasTimeout_and_request_takes_29_seconds_is_ok (0.01s) --- PASS: TestPlannedReparentShardSlow/nil_WaitReplicasTimeout_and_request_takes_31_seconds_is_error (0.01s) ok vitess.io/vitess/go/vt/vtctl/grpcvtctldserver 0.880s ``` Signed-off-by: Mohamed Hamza <[email protected]>
Some tests like TestPlayerBatchMode have subtests that share state. When gotestsum retries just the failed subtest, the state is already corrupted from subsequent subtests that ran. This flag makes gotestsum rerun the entire root test instead. Signed-off-by: Mohamed Hamza <[email protected]>
mattlord
left a comment
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.
❤️
|
Only concern I have that this seems to stop CI from using |
|
Digging a bit more, #9102 is when |
|
And I think vitessio/go-junit-report@a07af90 was the main reason for the fork. For workflows that automatically re-run failed test cases, the text output across different runs was accumulated and then send to Given that |
|
According to gotestyourself/gotestsum#281, I think |
|
I also see there's different levels of retry logic. In |
|
@arthurschreiber Thank you for taking a deep look at As for retries, I intentionally left out retries for I'm looking through it again and it looks like many tests themselves also create their own subdirectories under |
gotestsum handles JUnit report generation via JUNIT_OUTPUT env var, so go-junit-report is no longer needed. Signed-off-by: Mohamed Hamza <[email protected]>
34a5b1f to
d52af1a
Compare
Signed-off-by: Mohamed Hamza <[email protected]>
Signed-off-by: Mohamed Hamza <[email protected]>
|
I've reverted the changes to use |
Description
Switch tests to use gotestsum. gotestsum has a few benefits, namely prettier output, built-in junit report generation, automatic retries (individual tests, rather than full packages as some of our test infra does), and slow tests reporting.
The workflows will now report the top 20 slowest tests in the job summary. Click on any one of the jobs below to see the new output + job summary.
Backporting to improve release branches CI as well.
Related Issue(s)
Checklist
Deployment Notes
AI Disclosure
Helped by Claude