-
-
Notifications
You must be signed in to change notification settings - Fork 131
feat: treat timeouts as failure or success based on config #2742
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
base: main
Are you sure you want to change the base?
Conversation
|
Just confirmed that the failing tests in CI are these 3, which are snapshot tests for the formatting output. So all other tests are passing |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2742 +/- ##
==========================================
+ Coverage 80.12% 80.20% +0.07%
==========================================
Files 113 113
Lines 26167 26356 +189
==========================================
+ Hits 20967 21138 +171
- Misses 5200 5218 +18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sunshowers
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.
Thanks. One commit is fine for this change (though there's one particular thing in this PR that should be in a followup).
| period: far_future_duration(), | ||
| terminate_after: None, | ||
| grace_period: Duration::from_secs(10), | ||
| timeout_result: SlowTimeoutResult::Fail, |
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.
An inconsistency here -- we use SlowTimeoutResult::Fail here but default below. Let's pick one or the other -- I'm partial to using Fail and removing the Default impl, unless there's a good reason to retain it.
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 only issue with not having a SlowTimeoutResult::default is that AFAICT (I'm not that familiar with serde) the #[serde(default)] line in SlowTimeout's definition will have to be something like #[serde(default = "default_result")] where default_result is a custom function that returns the default value for SlowTimeoutResult. At that point I think it's just better to just keep the derived default and change this usage from SlowTimeoutResult::Fail to default.
From
pub struct SlowTimeout {
// Omitted fields
#[serde(default)]
pub(crate) on_timeout: SlowTimeoutResult,
}
To
pub struct SlowTimeout {
// Omitted fields
#[serde(default = "default_on_timeout")]
pub(crate) on_timeout: SlowTimeoutResult,
}
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.
I just noticed something, since VERY_LARGE is const, I can't actually call SlowTimeoutResult::default() since it's not const, so now I'm unsure what to do:
- Keep
#[derive(Default)]inSlowTimeoutResult, useSlowTimeoutResult::defaultin non-constcontexts andSlowTimeoutResult::Failinconstcontexts. - Keep
#[derive(Default)]just for#[serde(default)], useSlowTimeoutResult::Faileverywhere else - Remove
#[derive(Default)], add apub const fn default() -> Selfwhich can be used everywhere. This does mean that instead of#[serde(default)]we'll have#[serde(default = "SlowTimeoutResult::default")]inSlowTimeout's definition.
Option 1 doesn't seem that great to me, I think I prefer option 3, but option 2 is also fine.
c4e6773 to
5954546
Compare
|
So I've split off the changes into two commits, where the second one only deals with the logic in |
5954546 to
42f92f1
Compare
|
Tests are now passing, I changed the logic in pub fn failed_count(&self) -> usize {
self.failed + self.exec_failed + self.failed_timed_out
}I haven't added any new tests, but I'll get started on that now that all the old existing tests are passing. |
|
Looks great -- yeah, just missing new tests otherwise this is good to go. |
|
I have two questions regarding junit:
|
|
Did this in #2761. |
|
Hi! Something I just thought of, how should retries be handled when |
|
@eduardorittner I think not retrying is correct -- I also don't think a warning is necessary here, because the rules are very simple (pass = no retry, fail for any reason = retry). |
71b97a7 to
e7b102d
Compare
|
Added some new tests but they're now failing on windows, will try to fix that once I have some more time |
29cb1b4 to
8c65359
Compare
|
I'm probably missing something but it looks like some of the comments you marked resolved aren't actually resolved yet -- are you planning to work on them? |
|
yeah I'm sorry, hadn't even noticed that. I was working from two different computers and without realising it lost some of the changes I made whoch addressed them. I'll go back through every one to fix them again. My bad! |
088b419 to
e10ccc5
Compare
|
I've now gone over the resolved comments and I think I've re-resolved them all! |
e10ccc5 to
240e3ca
Compare
Adds a new configuration option inside "slow-timeout": "on-timeout" which when set to "pass" makes nextest treat timed out tests as passing. The logic for actually counting how many timed out tests were treated as successes will be made in a followup commit.
Since timed out tests can now be treated as either successes or failures, update the logic for handling them. This commit also adds tests for exercising edge cases between `on-timeout="pass"` and retries/flaky tests
240e3ca to
5308edd
Compare
Adds a new configuration option inside "slow-timeout": "on-timeout" which when set to "pass" makes nextest treat timed out tests as passing.
This PR adds a new
SlowTimeoutResultstruct similar toLeakTimeoutResultwhich characterizes a timeout as passing or failing.There are some things which need to be addressed, and most of them are marked with
TODOs in the code, these should all be fixed before merging. Most of them have to do with how to display this information, since we now have a new category of tests to display: tests that passed with a timeout. Any opinions here would be great!There are some failing tests due to the formatting changes made, I decided not to accept the snapshots just yet since I'm not sure this is the final formatting we're going to end up with.
P.S.: I noticed nextest follows atomic commits, I figured only one commit would be enough for this change but I can split it up into smaller commits if it's deemed better.
Closes #1291