From c37d5cf71d0c426371cdf059b5b2bc11a103c5ba Mon Sep 17 00:00:00 2001 From: GPK Date: Sat, 4 Jan 2025 15:11:58 +0000 Subject: [PATCH] Evaluate canary-run condition in run-tests SelectiveChecks (#45387) * evaluate canary run condition in workflow * Update run tests check to verify canary run --- .../airflow_breeze/utils/selective_checks.py | 2 ++ dev/breeze/tests/test_selective_checks.py | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/dev/breeze/src/airflow_breeze/utils/selective_checks.py b/dev/breeze/src/airflow_breeze/utils/selective_checks.py index 4229ed6858495..05a46475be432 100644 --- a/dev/breeze/src/airflow_breeze/utils/selective_checks.py +++ b/dev/breeze/src/airflow_breeze/utils/selective_checks.py @@ -746,6 +746,8 @@ def needs_helm_tests(self) -> bool: @cached_property def run_tests(self) -> bool: + if self._is_canary_run(): + return True if self.only_new_ui_files: return False # we should run all test diff --git a/dev/breeze/tests/test_selective_checks.py b/dev/breeze/tests/test_selective_checks.py index 0311a3c93298f..f87875d02b878 100644 --- a/dev/breeze/tests/test_selective_checks.py +++ b/dev/breeze/tests/test_selective_checks.py @@ -1829,6 +1829,42 @@ def test_no_commit_provided_trigger_full_build_for_any_event_type(github_event): ) +@pytest.mark.parametrize( + "github_event", + [ + GithubEvents.PUSH, + GithubEvents.SCHEDULE, + ], +) +def test_files_provided_trigger_full_build_for_any_event_type(github_event): + stderr = SelectiveChecks( + files=("airflow/ui/src/pages/Run/Details.tsx", "airflow/ui/src/router.tsx"), + commit_ref="", + github_event=github_event, + pr_labels=(), + default_branch="main", + ) + assert_outputs_are_printed( + { + "all-python-versions": "['3.9', '3.10', '3.11', '3.12']", + "all-python-versions-list-as-string": "3.9 3.10 3.11 3.12", + "ci-image-build": "true", + "prod-image-build": "true", + "needs-helm-tests": "true", + "run-tests": "true", + "docs-build": "true", + "skip-pre-commits": "identity,mypy-airflow,mypy-dev,mypy-docs,mypy-providers,mypy-task-sdk", + "upgrade-to-newer-dependencies": ( + "true" if github_event in [GithubEvents.PUSH, GithubEvents.SCHEDULE] else "false" + ), + "core-test-types-list-as-string": ALL_CI_SELECTIVE_TEST_TYPES, + "needs-mypy": "true", + "mypy-checks": "['mypy-airflow', 'mypy-providers', 'mypy-docs', 'mypy-dev', 'mypy-task-sdk']", + }, + str(stderr), + ) + + @pytest.mark.parametrize( "files, expected_outputs, pr_labels, commit_ref", [