-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Set 250 as an upper limit for retries #27797
Set 250 as an upper limit for retries #27797
Conversation
24 flaky tests on run #51044 ↗︎
Details:
commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-firefox
e2e/origin/commands/assertions.cy.ts • 1 flaky test • 5x-driver-firefox
cypress/cypress.cy.js • 3 flaky tests • 5x-driver-firefox
runs.cy.ts • 1 flaky test • app-e2e
specs_list_latest_runs.cy.ts • 1 flaky test • app-e2e
The first 5 flaky specs are shown, see all 12 specs in Cypress Cloud. Review all test suite changes for PR #27797 ↗︎ |
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.
any idea how this behaves when retries is set on the describe
or test
level? I wonder if its worth while to add a test to verify an error is thrown when the following happens. I'd think a system-test in retries_spec is sufficient?
describe('foo', { retries: 260 }, () => {
it('tests', () => {
expect(true).to.be.false
})
})
@AtofStryker I'm not sure we have any example of such test. We don't even test validating |
@mabela416 I pushed an update refactoring validation and providing more detailed error messaging |
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.
@mabela416 I believe setting |
If you check develop or even the feature/test-burn-in branch, if you try to just do, you'll get an error
|
@mabela416 correct, using a boolean for these fields is a new option added within this initiative. See: https://github.com/cypress-io/cypress/pull/27412/files#diff-9fde1fb2f7eaba5ea49b585c811461495bfbba88e614e900a96863ecfe6b980aR2842 |
I believe that is only the case IF |
@mabela416 this is expected since there is no |
@MuazOthman We do test this is it just isn't obvious. I am working on a review description to help point you in the correct place, but we might want to change the way we approach this PR. More details soon! |
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.
Sorry it has taken me so long to re-review this PR.
I think there is quite a bit going on in this PR and it is trying to accomplish two things:
- set the retries limit to 250, inclusive of burn and other properties
- refactor the messaging/validation logic for experimental retries.
What I think we might want to do here, since some might view the 250
limit on retries a breaking change, is PR the validation update for current GA retries to 250
into develop
and create a CHANGELOG entry as a bugfix
. This would also be a more refined changed, and we can add the config tests and system test in testConfigOverrides, which we would just need a test in testConfigOverrides cypress specs that tests the retries threshold. A current example is this system test, which runs this spec and fails since the override is invalid. Either myself or someone on the app team can help you with this since sometimes getting this set up isn't exactly obvious.
Then, when that change goes in, merge it into feature/test-burn-in
feature branch, and create a PR that goes into feature/test-burn-in
that sets the limits mentioned in the PR descriptions and refactors the messaging validation logic to handle default merging when no value is present. Technically the later can be done independently if we think that is a better option.
Does that sound like an OK plan moving forward?
@@ -883,29 +883,29 @@ describe('lib/config', () => { | |||
}) | |||
|
|||
context('retries', () => { | |||
const retriesError = 'a positive number or null or an object with keys "openMode" and "runMode" with values of numbers, booleans, or nulls, or experimental configuration with key "experimentalStrategy" with value "detect-flake-but-always-fail" or "detect-flake-and-pass-on-threshold" and key "experimentalOptions" to provide a valid configuration for your selected strategy' | |||
// const retriesError = 'a positive number or null or an object with keys "openMode" and "runMode" with values of numbers, booleans, or nulls, or experimental configuration with key "experimentalStrategy" with value "detect-flake-but-always-fail" or "detect-flake-and-pass-on-threshold" and key "experimentalOptions" to provide a valid configuration for your selected strategy' |
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.
// const retriesError = 'a positive number or null or an object with keys "openMode" and "runMode" with values of numbers, booleans, or nulls, or experimental configuration with key "experimentalStrategy" with value "detect-flake-but-always-fail" or "detect-flake-and-pass-on-threshold" and key "experimentalOptions" to provide a valid configuration for your selected strategy' |
'type': 'a positive number or null or an object with keys "openMode" and "runMode" with values of numbers, booleans, or nulls, or experimental configuration with key "experimentalStrategy" with value "detect-flake-but-always-fail" or "detect-flake-and-pass-on-threshold" and key "experimentalOptions" to provide a valid configuration for your selected strategy', | ||
'key': 'mockConfigKey.experimentalStrategy', | ||
'value': 'foo', | ||
'type': 'one of "detect-flake-but-always-fail", "detect-flake-and-pass-on-threshold"', |
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.
These errors on config validation are way more readable and thank you for cleaning them up!
The one thing that is a bit critical here though is making sure that defaults get applied into the config so the app can access them through the client/server, which was one of the reasons it was an 'all or nothing' approach originally. For example:
openMode: true,
experimentalStrategy: 'detect-flake-but-always-fail'
Is a valid end user config, but we need to add defaults to the object in the app so they can be globally available. This needs to be transformed into:
openMode: true,
runMode: false,
experimentalStrategy: 'detect-flake-but-always-fail'.
experimentalOptions: {
maxRetries: 2,
stopIfAnyPassed: false,
}
defaultValue
can take a function, but it doesn't expose the values present in the config at time of invocation.
The only thing I can think to accomplish this without adding a new mechanism, is to add defaults in the object when validation occurs since these happen by reference. Which means the validate function would have side effects
|
||
if (!isValidStopIfAnyPasses) { | ||
return false | ||
return errMsg(`${key}.stopIfAnyPassed`, value.stopIfAnyPassed, 'null or boolean') |
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.
stopIfAnyPassed
I believe can either be a boolean
or undefined
but null
is not an option based on 1137. If this has changed, we need to update the typings definition in the app in cypress.d.ts
(which we might need to do anyway since the current implementation forces a user to specify it if they provide experimentalOptions
on detect-flake-but-always-fail
So you're expected to get an error right? Something in this PR is allowing the user to set runMode and openMode as booleans without |
I think I read this as the inverse. You are correct that configuration should error. It might be due to some of the reasons I outlined in #27797 (comment). We might want to treat the configuration changes as a separate PR. |
As previously discussed, we don't need this new limit of 250 anymore. I extracted the enhanced validation to a new PR #28214. |
This PR sets an upper limit of 250 (inclusive) for all config values specifying the number of retries in the cloud, including:
retries
when set to a numberretries.runMode
retries.openMode
retries.experimentalOptions.maxRetries
experimentalBurnIn.default
experimentalBurnIn.flaky
PR Tasks
cypress-documentation
?type definitions
?