-
Notifications
You must be signed in to change notification settings - Fork 105
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
fix: properly handle skip on assessments #473
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Philippe Scorsolini <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: phisco The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @phisco. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
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 for catching and fixing the bug.
however I'm not entirely sure about the sematic of --fail-fast, so I'd appreciate if someone could clarify that.
I don't have the full context but from my understanding, --fail-fast
is an attempt to adapt the go test -failfast
flag to the e2e-framework, ie have a way to stop assessments and features executions early.
For sure, independently of --fail-fast a call to t.Skip* in an Assessment should only skip the current Assessment. But in case of calls to t.Fail or t.FailNow, what should be the behaviour in the two cases?
In my understanding of the framework, Assessments can be kinda linked together as part of the same 'Test' while features are some kind of distinct 'Test'.
Based on the semantics of Fail
(marks the function as having failed but continues execution.
) and FailNow
(marks the function as having failed and stops its execution by calling runtime.Goexit. Execution will continue at the next test or benchmark.
), my interpretation is that:
- a call to
Fail
should not attempt to skip any remaining assessment or feature - a call to
FailNow
should skip all the remaining assessment but not skip the next features
I guess the behavior for FailNow
could be argued for or against skipping the next features too. But this is more a question of whether features should be considered independent or not, which, as far as I know is not really clarified anywhere.
// invoked to make sure we leave the traces of the failed test behind to enable better debugging for the | ||
// test developers | ||
if e.cfg.FailFast() && failed { | ||
newT.FailNow() |
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.
will the failure be propagated properly to the parent test without this?
// The test passed, nothing to do | ||
return | ||
} | ||
if !finished && e.cfg.FailFast() { |
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.
if !finished && e.cfg.FailFast() { | |
if !finished || e.cfg.FailFast() { |
shouldn't this be an or
instead? Based on the comment below
// The test didn't finish, this means t.FailNow was called | ||
// or we are in fail fast mode, we should skip the remaining assessments |
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 test didn't finish, this means t.FailNow was called | |
// or we are in fail fast mode, we should skip the remaining assessments | |
// The test failed and either: | |
// didn't finish, this means t.FailNow was called | |
// OR we are in fail fast mode. | |
// We should skip the remaining assessments |
maybe a bit more explicit?
// test developers | ||
if e.cfg.FailFast() && failed { | ||
newT.FailNow() | ||
if failFast { |
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'm not sure if we should also skip teardowns when t.FailNow()
is called. In particular, I'm not sure it is very logical to skip teardowns for t.FailNow()
but not for t.Fail()
.
In which case, scoping to failed tests with FailFast
configured would be better I think. What do you think?
Makes sense, @Fricounet, but what about e2e-framework/examples/fail_fast/README.md Lines 3 to 11 in b69e158
|
I'd say so too @phisco. Though, I don't agree with everything written in the README. In particular:
To me, this is the job of Basically:
Hope that makes sense 😄 |
What type of PR is this?
/kind bug
What this PR does / why we need it:
t.Skip
with--fail-fast
was resulting in the parent test being failed, this patch fixes that, however I'm not entirely sure about the sematic of--fail-fast
, so I'd appreciate if someone could clarify that.For sure, independently of
--fail-fast
a call tot.Skip*
in anAssessment
should only skip the current Assessment. But in case of calls tot.Fail
ort.FailNow
, what should be the behaviour in the two cases?Which issue(s) this PR fixes:
Fixes #472
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., Usage docs, etc.: