forked from near/nearcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor our test separation and how we run them (near#12458)
This fundamentally removes the differentiation between "integration" and "unit" tests from the test runner perspective, as well as removes the reliance on the "expensive-tests" compile-time feature. Instead tests are categorized by the underlying reason for which we had the separation in the first place -- test execution speed. These are now annotated with `slow_test_` and `ultraslow_test_` prefixes, and their execution time is enforced by time limits in `nextest.toml`. By using `nextest` filters we can cleanly filter out tests from these three categories to be run in various contexts. For instance, maybe quick checks locally don't need to run the slow tests every time -- `just nextest` by default now takes just 9 seconds (on my machine) to run all the tests. Whereas previously (due to e.g. estimator smoke test) it would take at least a minute. Then a `just nextest-slow` is added in the rarer cases where one might want to run the full suite that runs on CI. CI will run these mildly slower tests for each PR. Then what remains are the ultraslow tests which only run on nayduck and can take quite some time to complete. These can now be trivially run locally as well with `just nextest-all` without necessarily rebuilding the entire project or "unignoring" tests that are marked as ignored for other reasons (like for instance because they're just broken.)
- Loading branch information
Showing
63 changed files
with
521 additions
and
672 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,24 +1,45 @@ | ||
# By default tests should not take more than 5 seconds to execute and will get killed after 15 | ||
# seconds. | ||
# | ||
# If that happens, instead of making the period longer here, change the test name to one of the | ||
# next test "speed tiers" by using `slow_test_` or `ultra_slow_test` prefix for the test's name. | ||
[profile.default] | ||
slow-timeout = { period = "60s", terminate-after = 3, grace-period = "0s" } | ||
slow-timeout = { period = "5s", terminate-after = 3, grace-period = "1s" } | ||
default-filter = "not (test(/^(.*::slow_test|slow_test)/) | test(/^(.*::ultra_slow_test|ultra_slow_test)/))" | ||
final-status-level = "slow" | ||
|
||
# Tests that take a longer time to execute. `slow_test*` tests are given 1m30s to execute. | ||
[[profile.default.overrides]] | ||
filter = 'test(test_full_estimator)' | ||
slow-timeout = { period = "10m", terminate-after = 3 } | ||
retries = 0 | ||
threads-required = 2 | ||
filter = 'test(/^(.*::slow_test|slow_test)/)' | ||
slow-timeout = { period = "30s", terminate-after = 3, grace-period = "1s" } | ||
|
||
# Tests that take longer than the heat death of the universe of time to execute. Consider making | ||
# the test faster, but if you must `ultra_slow_test*` tests are given 1h to execute. These are | ||
# generally left for nayduck to execute. | ||
[[profile.default.overrides]] | ||
filter = 'test(/^(.*::ultra_slow_test|ultra_slow_test)/)' | ||
slow-timeout = { period = "30m", terminate-after = 2, grace-period = "1s" } | ||
|
||
|
||
# Unfortunately no support for inheriting profiles yet: | ||
# https://github.com/nextest-rs/nextest/issues/387 | ||
[profile.ci] | ||
slow-timeout = { period = "120s", terminate-after = 5 } | ||
slow-timeout = { period = "5s", terminate-after = 5, grace-period = "1s" } | ||
default-filter = "not test(/^(.*::ultra_slow_test|ultra_slow_test)/)" | ||
# Try a few times before failing the whole test suite on a potentially spurious tests. | ||
# The hope is that people will fix the spurious tests as they encounter them locally... | ||
retries = { backoff = "fixed", count = 3, delay = "1s" } | ||
failure-output = "final" | ||
fail-fast = false | ||
|
||
# Tests that take a longer time to execute. `slow_test*` tests are given 1m30s to execute. | ||
[[profile.ci.overrides]] | ||
filter = 'test(/^(.*::slow_test|slow_test)/)' | ||
slow-timeout = { period = "30s", terminate-after = 3, grace-period = "1s" } | ||
|
||
# Tests that take longer than the heat death of the universe of time to execute. Consider making | ||
# the test faster, but if you must `ultra_slow_test*` tests are given 1h to execute. These are | ||
# generally left for nayduck to execute. | ||
[[profile.ci.overrides]] | ||
filter = 'test(test_full_estimator)' | ||
slow-timeout = { period = "10m", terminate-after = 3 } | ||
retries = 0 | ||
threads-required = 2 | ||
filter = 'test(/^(.*::ultra_slow_test|ultra_slow_test)/)' | ||
slow-timeout = { period = "30m", terminate-after = 2, grace-period = "1s" } |
This file contains 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 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 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 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 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 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.