chore: adds quality gate for rerunning e2e spec files that are new or have been modified#24556
Merged
chore: adds quality gate for rerunning e2e spec files that are new or have been modified#24556
Conversation
Contributor
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
seaona
commented
May 16, 2024
seaona
commented
May 16, 2024
seaona
commented
May 16, 2024
…logic is working properly in failing tests
DDDDDanica
reviewed
May 20, 2024
seaona
commented
May 21, 2024
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #24556 +/- ##
========================================
Coverage 69.57% 69.57%
========================================
Files 1360 1360
Lines 48172 48172
Branches 13296 13296
========================================
Hits 33513 33513
Misses 14659 14659 ☔ View full report in Codecov by Sentry. |
Collaborator
Builds ready [71bbf50]
Page Load Metrics (623 ± 464 ms)
Bundle size diffs
|
DDDDDanica
previously approved these changes
May 21, 2024
vthomas13
previously approved these changes
May 21, 2024
danjm
reviewed
May 22, 2024
Gudahtt
reviewed
Jun 27, 2024
Gudahtt
reviewed
Jun 27, 2024
Gudahtt
reviewed
Jun 27, 2024
Gudahtt
reviewed
Jun 27, 2024
Gudahtt
reviewed
Jun 27, 2024
Gudahtt
reviewed
Jun 27, 2024
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Collaborator
Builds ready [9b1c7cc]
Page Load Metrics (140 ± 187 ms)
Bundle size diffs
|
Gudahtt
reviewed
Jun 28, 2024
…suggestion Co-authored-by: Mark Stacey <markjstacey@gmail.com>
|
HowardBraham
approved these changes
Jun 28, 2024
Collaborator
Builds ready [07e81d8]
Page Load Metrics (186 ± 204 ms)
Bundle size diffs
|
chloeYue
approved these changes
Jul 1, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
This PR adds a quality gate for new or modified e2e spec files. Whenever there is a PR which modifies or changes a test, this will be run more times, in order to prevent introducing a flakiness accidentally. It is done as follows:
git diffand using these 2 filters:file.filename.startsWith('test/e2e/') &&file.filename.endsWith('.spec.js') || file.filename.endsWith('.spec.ts')--retry-until-failureI just leveraged this into theforloop for each test, and if that testcase was identified as new/modified, the flag is added so the new tests fail fast without retrialsIncremental git fetch depth within shallow clone
We use git fetch with incremental depth as @danjm suggested. The ci environment uses a shallow clone, meaning we won't be able to succeed just by using git diff as it won't find the merge base. For fixing that, we start with a git fetch depth of 1, and keep incrementing the depth (1, 10, 100) it the error is
no merge baseup until 100. If the git diff still fails, we then do a full git fetch with theunshallowflag.New ci Job
The git diff is done in a new ci job which runs at the beginning in parallel of prep-deps.
Related issues
Fixes: #24009
Manual testing steps
Screenshots/Recordings
=============================================== [UPDATE with the new code changes]
new-tests-ci.mp4
https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/89277/workflows/7fce0a2e-773f-46da-8ab9-1dbec7992b58/jobs/3297267/parallel-runs/10?filterBy=ALL
🟢 Case 2: A test has changed, but it has a mistake in the code (intentionally to simulate a flaky test) -> it fails immediately and there are no more retries. The rest of the tests, are retried if they failed as usual
🟢 Case 3: A PR has no test spec files changed -> nothing different happens
ci run: check current ci
Pre-merge author checklist
Pre-merge reviewer checklist