-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
skip tests when -short #12869
skip tests when -short #12869
Conversation
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.
The parent test would fail with -short
because it registered expectations that a sub-test fulfills, and only the sub-tests are skipped.
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.
Evidently you can't call testing.Short()
from a func init()
, but this works the same.
main_test.go
Outdated
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.
Some of these use the DB, but mostly they can just be slow.
Btw, if someone writes a new DB-dependent test, is there any way for them to recognize that they should also probably use the "SkipShortDB" method in their test? For example, do we run "go test -short" on presubmit [if yes, can we fail if it takes significantly longer than before]? |
I was hoping to run it in CI so they would see it when they push. I reduced the runtime from 60s to 40s, which might be OK for CI, but still seems quite slow for a presumbit hook 🤔 |
Sorry, is it possible to see how long the presubmit takes now on average. |
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.
This takes a little over 1 minute to run. However, the net time added should be much less, and could be 0, since several things are cached, meaning that time spent here is saved later:
- downloading deps
- compiling packages
- tests results
Quality Gate passedIssues Measures |
I was thinking about git |
Running
go test -short
used to skip all DB dependent tests, among others. This PR restores that behavior, and tweaks a few others things that have made it difficult to run-short
. Nowgo test -short ./...
completes in ~40s, and just ~10s if cached.I also added an early step to the ci-core workflow to execute these tests as a spot check. This will provide quicker feedback than waiting for the full suite to fail, and shouldn't actually cost us any extra time in theory 🧮