-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution] Guarantee Cypress Reliability: Stabilizing Using Clean Retries #174247
Comments
Pinging @elastic/security-solution (Team: SecuritySolution) |
@MadameSheema I'd like to understand the necessity and urgency of the changes proposed in this ticket. In other words:
I'm sceptical about the proposed change, because it doesn't match common testing best practices. In any kind of automated tests, running some common cleanup or setup logic in Maybe, it would be enough (and better) to add retry logic to a select subset of functions that we consider prone to flakiness, as it was done in #173998 and #176316. |
It would be great. Once our tests are integrated with the kibana second quality gate, any failure on any test will block a deployment.
Ideally, any test, starting with those considered potentially flaky would be great! We can of course discuss different strategies to achieve the same point.
The main blocker for enabling the tests on the 2nd quality gate is the number of flaky tests we have been facing. This is a strategy to minimize the risk of failure which I don't like because I agree with you that sometimes does not match with common best practices as the execution time.
We need to make sure our tests are stable on MKI environment, this is just a task that might help with it.
I understand your point. Cypress has a built-in retry, if the test fails one time it executes the test again. The main issue of that built-in mode is that if the failure happens in a before or after hook, the retry is not triggered and the test is marked as failed inmediately. |
@MadameSheema just to confirm, are you saying that es_archiver calls are not prone to fail? (and therefore OK in before/after calls?) |
Yup :) |
…before` and `after` calls in cypress tests (#177175) ## Summary A couple of small tweaks to our cypress tests to move any non-archiver code out of `before` and `after` hooks and into `beforeEach`. Flaky test run serverless and ess https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5219 ✅ ✅ See #174247 for context Co-authored-by: Kibana Machine <[email protected]>
…before` and `after` calls in cypress tests (elastic#177175) ## Summary A couple of small tweaks to our cypress tests to move any non-archiver code out of `before` and `after` hooks and into `beforeEach`. Flaky test run serverless and ess https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5219 ✅ ✅ See elastic#174247 for context Co-authored-by: Kibana Machine <[email protected]>
We all know that flakiness may happen from time to time, ideally, the only flakiness that we should face, is the one regarding external factors as slow machines or network issues.
With Cypress we have the test retries functionality enabled. Test retries has been configured with 1 retry attempt, Cypress will retry a failed test an additional time (for a total of 2 attempts) before potentially being marked as a failed test. When a test is re-executed, the
each
hooks will be re-run as well, however, failures inbefore
andafter
hooks will not trigger a retry and the test will be marked as failure.So in order to have 'retriable' tests, we should get rid off the
before
andafter
hooks in favor of thebeforeEach
andafterEach
hook. Or at least make sure that the code executed in thebefore
andafter
hook is not prone to fail (i.e. es_archiver).Another thing we need to take into consideration to guarantee that a test can be retried is to make sure that the data that the test might generate is properly cleaned.
Each spec file is executed on a clean environment, but, retries are not. Retries are executed on the same environment the execution was initiated, this is why is pretty important to make sure that the data the test may generate is cleaned at the beginning.
The text was updated successfully, but these errors were encountered: