Allow overall test to pass when a retried phase eventually succeeds#1274
Allow overall test to pass when a retried phase eventually succeeds#1274aoyoqui wants to merge 2 commits intogoogle:masterfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Thanks for your contribution! This is indeed a bug. However, my thinking is that |
|
Thanks for the prompt reply. Yes, I added the flag My comment in the description regarding So if you want to change the behaviour, I can remove this new flag and use the existing If my proposal is ok, I could add some more cases in With
Note that |
|
Ah right, I meant This If we get rid of So I have to weigh the balance of further complicating the API (it already has a number of "repeat"-like options) vs potentially breaking existing users. I think we should not add another option, "fix" this behavior, and see if anyone expresses a desire for the original behavior. So, can you:
I might have missed something - let me know what you think. |
…to mark failed iterations SKIP
9e5c93b to
1b598fb
Compare
|
…is True, unless repeat_limit is reached. Remove skip_failed_retries flag; fix behaviour instead
1b598fb to
26f13e5
Compare
Summary
With repeat_on_measurement_fail, a phase can run multiple times after measurement failures. Each failed run is recorded as a phase with outcome FAIL. Overall outcome is “any FAIL phase → test FAIL,” so the test is reported as Failed even when a later retry passes. That makes “retry until it passes” unusable when the desired result is “test Passed if the last run passed.”
New phase option: skip_failed_retries
When set with repeat_on_measurement_fail, a run that fails and triggers a retry is recorded as SKIP instead of FAIL. Retries still run; only the stored outcome of that iteration changes. The last run still decides the phase (PASS/FAIL), and the existing rule for overall outcome is unchanged: any FAIL phase → test FAIL. So if the last run passes, there is no FAIL phase and the test can be Passed.
Why implement it in the executor?
Single rule: “Any phase with outcome FAIL → test FAIL” stays the only rule. We don’t add a second path that ignores some FAILs only at finalization.
stop_on_first_failure: That logic uses phases[-1].outcome == FAIL. By turning the failed iteration into SKIP before retrying, the last phase is no longer FAIL, so we don’t stop and the retries run. If we only changed finalization and left those iterations as FAIL, we’d have to special-case “don’t stop when this FAIL will be retried” in the executor as well, duplicating the “this FAIL doesn’t count” rule.
History change: The trade-off is of course that we rewrite history. The user must decide if having failed retries is a must. For my particular use case, marking failed retries as SKIP actually simplifies data analysis