Skip to content

GH-3891 - Configure quarantineMode #6073

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

Merged
merged 22 commits into from
Apr 27, 2021

Conversation

rob4629
Copy link
Contributor

@rob4629 rob4629 commented Mar 22, 2021

Purpose

Describe the problem you want to address or the feature you want to implement.
Closes #3891 : Allow for Quarantine threshold values to be configured (instead of hardcoded to 3). This should include the number of retries, as well as the minimum number of passes.

Approach

Describe how your changes address the issue or implement the desired functionality in as much detail as possible.
I amended quarantineMode to optionally accept a Dictionary. Parse the input (and validate), then use this to set the threshold values of failedThresholdReached and passedThresholdReached

References

Provide a link to the existing issue(s), if any.
#3891

Pre-Merge TODO

  • Write tests for your proposed changes
  • Make sure that existing tests do not fail

Sorry, something went wrong.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Mar 22, 2021
@rob4629 rob4629 marked this pull request as draft March 22, 2021 21:48
@testcafe-build-bot
Copy link
Collaborator

@miherlosev miherlosev removed the STATE: Need response An issue that requires a response or attention from the team. label Mar 24, 2021
@testcafe-build-bot
Copy link
Collaborator

@testcafe-build-bot
Copy link
Collaborator

@miherlosev
Copy link
Collaborator

Hi @rob4629
Thank you for contributing to TestCafe. You expose internal failedThreshold and passedThreshold parameters via quarantineMode { "passCount": 1, "retryCount": 5 } API.
Description of parameters:

  • passCount is the number of passed test runs to consider the test passed
  • retryCount is the number of failed test runs to consider the test failed

In general, this approach is good.
At the same time, we believe that the retryCount parameter should be a full test run count that TestCafe will execute.
For example:

  • consider the test passed if at least one run passed - quarantineMode { "passCount": 1 }
  • increase the number of test run attempts - `quarantineMode { "retryCount": 10 }

This approach doesn't seem to require a lot of changes. You need to calculate the failedThreshold value as a result of the retryCount minus passCount expression and validate if that passCount is less than retryCount.

@rob4629
Copy link
Contributor Author

rob4629 commented Mar 25, 2021

Thanks for the feedback @miherlosev. I can implement that change today. Does passCount seem a sensible/explicit name to you, or should this be passThreshold?

Also, it looks like my change has broken existing functionality:

testcafe -q tests/myFixture/myTest.js

ERROR The "--quarantine-mode" option value is not a valid key-value pair.

If I explicitly add the testpath argument afterwards, it behaves as expected

testcafe -q -t myFixture

Although I'm validating it's a valid Key-Value pair in getQuarantineOptions, should I add some sort of filtering/conditions to _parseQuarantineOptions?

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Mar 25, 2021
@rob4629
Copy link
Contributor Author

rob4629 commented Mar 25, 2021

This approach doesn't seem to require a lot of changes. You need to calculate the failedThreshold value as a result of the retryCount minus passCount expression and validate if that passCount is less than retryCount.

Ok, I don't think I understand your suggestion... here's how it sounds to me (pseudocode)

const failedThreshold = passCount < retryCount ? retryCount - passCount : DEFAULT_QUARANTINE_THRESHOLD;

const failedThresholdReached = failedTimes >= failedThreshold;
....
testcafe -q                                // no change
testcafe -q passCount=1                    // failedThreshold = 2
testcafe -q retryCount=5                   // failedThreshold = 2
testcafe -q retryCount=10                  // failedThreshold = 7
testcafe -q retryCount=10,passCount=1      // failedThreshold = 9

Is that your expectation?

@AndreyBelym AndreyBelym changed the title [DRAFT] RC3891 - Configure quarantineMode [DRAFT] GH3891 - Configure quarantineMode Mar 29, 2021
@AndreyBelym AndreyBelym changed the title [DRAFT] GH3891 - Configure quarantineMode [DRAFT] GH-3891 - Configure quarantineMode Mar 29, 2021
@miherlosev
Copy link
Collaborator

In general, you understand the explanation correctly.
Just one correction: you should validate that the passCount is less than retryCount.

Pseudocode

validateArguments({ retryCount, passCount });

const failedThreshold = retryCount - passCount;

const failedThresholdReached = failedTimes >= failedThreshold;

// All correct
testcafe -q                                // no change
testcafe -q passCount=1                    // failedThreshold = 2
testcafe -q retryCount=5                   // failedThreshold = 2
testcafe -q retryCount=10                  // failedThreshold = 7
testcafe -q retryCount=10,passCount=1      // failedThreshold = 9

// Raise an error about incorrect parameters
testcafe -q retryCount=3,passCount=4

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Mar 29, 2021
@rob4629
Copy link
Contributor Author

rob4629 commented Mar 29, 2021

Ok, I've added further validation to the argument-parser, plus 2 new tests to verify passCount < retryCount.

I've also implemented the failedThreshold as per your request, however I believe we should have a minimum failedThreshold of 3, rather than setting failedThreshold to 1 for -q retryCount=4 or -q passCount=1.

Ultimately the decision is yours, but I look forward to hearing your thoughts.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Mar 29, 2021
@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Apr 15, 2021
@AlexKamaev AlexKamaev added the STATE: Need response An issue that requires a response or attention from the team. label Apr 15, 2021
@testcafe-build-bot
Copy link
Collaborator

@AlexKamaev AlexKamaev closed this Apr 16, 2021
@AlexKamaev AlexKamaev reopened this Apr 16, 2021
@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Apr 16, 2021
@AlexKamaev AlexKamaev closed this Apr 16, 2021
@AlexKamaev AlexKamaev reopened this Apr 16, 2021
@need-response-app need-response-app bot added STATE: Need response An issue that requires a response or attention from the team. and removed STATE: Need response An issue that requires a response or attention from the team. labels Apr 16, 2021
@testcafe-build-bot
Copy link
Collaborator

@rob4629
Copy link
Contributor Author

rob4629 commented Apr 22, 2021

Do you need me to do more for this PR? It seems like my local master branch has become corrupted... So I'm trying to resolve that before I can investigate these failing tests

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Apr 22, 2021
@DIRECTcut
Copy link
Contributor

DIRECTcut commented Apr 22, 2021

@rob4629 Great PR.

We've moved our documentation to a separate repository and it's not available for open-source contributions anymore. Please rebase your PR and remove all documentation changes (changes to .md files) from this PR.

I'll make sure that the documentation for this new feature makes it to our website.

Thanks.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Apr 22, 2021
@testcafe-build-bot
Copy link
Collaborator

@testcafe-build-bot
Copy link
Collaborator

@testcafe-build-bot
Copy link
Collaborator

@testcafe-build-bot
Copy link
Collaborator

@testcafe-build-bot
Copy link
Collaborator

@testcafe-build-bot
Copy link
Collaborator

@testcafe-build-bot
Copy link
Collaborator

@testcafe-build-bot
Copy link
Collaborator

@testcafe-build-bot
Copy link
Collaborator

@testcafe-build-bot
Copy link
Collaborator

@miherlosev miherlosev merged commit 929b4b0 into DevExpress:master Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow configuring the quarantine mode
6 participants