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
4 changes: 4 additions & 0 deletions dev/breeze/src/airflow_breeze/utils/selective_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,10 @@ def _should_run_all_tests_and_versions(self) -> bool:
f"[warning]Only text non doc files changed in {self._github_event}, skip full tests[/]"
)
return False
# On push to release branches (v3-X-test, etc), only run selective tests.
# Canaries (SCHEDULE) and manual triggers (WORKFLOW_DISPATCH) still run full matrix.
if self._github_event == GithubEvents.PUSH and self._default_branch != "main":
return False
console_print(f"[warning]Running everything because event is {self._github_event}[/]")
return True
if not self._commit_ref:
Expand Down
56 changes: 56 additions & 0 deletions dev/breeze/tests/test_selective_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3909,3 +3909,59 @@ def test_helm_test_kubernetes_versions(
default_branch="main",
)
assert_outputs_are_printed(expected_outputs, str(stderr))


@pytest.mark.parametrize(
("github_event", "default_branch", "expected_all_versions"),
[
pytest.param(
GithubEvents.PUSH,
"v3-2-test",
"false",
id="Push to release branch does not force all versions",
),
pytest.param(
GithubEvents.SCHEDULE,
"main",
"true",
id="Schedule (canary) forces all versions",
),
pytest.param(
GithubEvents.WORKFLOW_DISPATCH,
"main",
"true",
id="Workflow dispatch forces all versions",
),
],
)
@patch.dict("os.environ", {"GITHUB_TOKEN": "test_token"})
@patch("requests.get")
def test_push_to_release_branch_does_not_force_full_tests(
mock_get, github_event, default_branch, expected_all_versions
):
"""Test that push to release branches (v3-X-test) does not force full test matrix,
while canaries (SCHEDULE) and manual triggers still do."""
# Mock GitHub API calls for runner_type property (used in PUSH/SCHEDULE events)
workflow_response = Mock()
workflow_response.status_code = 200
workflow_response.json.return_value = {"workflow_runs": [{"jobs_url": "https://api.github.com/jobs/123"}]}
jobs_response = Mock()
jobs_response.status_code = 200
jobs_response.json.return_value = {
"jobs": [{"name": "Basic tests (ubuntu-22.04)", "labels": ["ubuntu-22.04"]}]
}
mock_get.side_effect = [workflow_response, jobs_response]

stderr = SelectiveChecks(
files=("airflow-core/src/airflow/models/dag.py",),
commit_ref=NEUTRAL_COMMIT,
github_event=github_event,
pr_labels=(),
default_branch=default_branch,
)
assert_outputs_are_printed(
{
"all-versions": expected_all_versions,
},
str(stderr),
)
Loading