Repository navigation
Fixes 33644: stop backend integration-test changes from running the whole Playwright suite #33645
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
63 changes: 63 additions & 0 deletions
63
.github/scripts/tests/test_playwright_backend_it_selection.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import json | ||
| import subprocess | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
|
|
||
| REPOSITORY_ROOT = Path(__file__).parents[3] | ||
| IMPACT_MAP = REPOSITORY_ROOT / ".github/playwright/impact-map.json" | ||
| SELECTOR = REPOSITORY_ROOT / ".github/scripts/select_playwright_tests.py" | ||
|
|
||
| BACKEND_IT = ( | ||
| "openmetadata-integration-tests/src/test/java/org/openmetadata/it/util/" | ||
| "SqlQueryCounter.java" | ||
| ) | ||
| UNMAPPED_SERVICE = ( | ||
| "openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java" | ||
| ) | ||
|
|
||
|
|
||
| def _select(tmp_path: Path, *changed: str) -> dict: | ||
| changed_files = tmp_path / "changed.txt" | ||
| changed_files.write_text("\n".join(changed) + "\n", encoding="utf-8") | ||
| output = tmp_path / "selection.json" | ||
| subprocess.run( | ||
| [ | ||
| sys.executable, | ||
| str(SELECTOR), | ||
| "--event-name", | ||
| "pull_request", | ||
| "--changed-files", | ||
| str(changed_files), | ||
| "--impact-map", | ||
| str(IMPACT_MAP), | ||
| "--full-suite", | ||
| "false", | ||
| "--output", | ||
| str(output), | ||
| ], | ||
| check=True, | ||
| capture_output=True, | ||
| ) | ||
| return json.loads(output.read_text(encoding="utf-8")) | ||
|
|
||
|
|
||
| def test_backend_integration_test_changes_do_not_escalate_to_the_full_suite(tmp_path): | ||
| # openmetadata-integration-tests/ is in UNMAPPED_CODE_ROOTS, so without an impact-map entry | ||
| # every backend-IT change ran the whole Playwright suite — and when the chromium lane cannot | ||
| # be planned within its shard cap, that is a hard CI failure on a PR that touches no UI. | ||
| assert _select(tmp_path, BACKEND_IT)["mode"] == "targeted" | ||
|
|
||
|
|
||
| def test_backend_integration_test_changes_still_run_the_smoke_net(tmp_path): | ||
| # Mapped to no specs, not excluded: the smoke and canary selectors must still be chosen, so | ||
| # demoting these paths from "full" narrows the run without dropping the safety net to nothing. | ||
| assert _select(tmp_path, BACKEND_IT)["selectors"] | ||
|
|
||
|
|
||
| def test_an_unmapped_backend_path_alongside_it_changes_still_escalates(tmp_path): | ||
| # The mapping must not be a blanket "backend changes are safe" switch: a service change in the | ||
| # same PR is still an unmapped code path and must take the whole suite with it. | ||
| assert _select(tmp_path, BACKEND_IT, UNMAPPED_SERVICE)["mode"] == "full" |
Oops, something went wrong.
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.
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.
For a backend-integration-test-only change, this empty mapping marks the path as mapped, so
unmapped_changeis false. The selector therefore keeps the six unconditional smoke specs but skips the canary selectors, which are added only for shared-infrastructure or unmapped changes. These PRs consequently lose the promised canary safety net. Add the canary specs and projects to this mapping or explicitly select them, and test for their presence instead of only checking thatselectorsis nonempty.