Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/playwright/impact-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,12 @@
"specs": [
"playwright/e2e/Features/AppMode/**/*.spec.ts"
]
},
{
"_comment": "Backend integration tests are a test-only Maven module — not packaged into the server the suite runs against, nor into the UI bundle — so no change here can alter a spec outcome. Mapped to no specs rather than left unmapped: openmetadata-integration-tests/ is in UNMAPPED_CODE_ROOTS, so without this every backend-IT change escalates to a full-suite run.",
"sources": ["openmetadata-integration-tests/**"],
"projects": [],
"specs": []
Comment on lines +781 to +782

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Canary coverage is omitted

For a backend-integration-test-only change, this empty mapping marks the path as mapped, so unmapped_change is 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 that selectors is nonempty.

}
]
}
63 changes: 63 additions & 0 deletions .github/scripts/tests/test_playwright_backend_it_selection.py
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"
Loading