Skip to content

Commit ee97d7b

Browse files
authored
Do not trigger provider tests on core changes (apache#40776)
Provider tests have been triggered when core airflow changed. This has been done in order to avoid some core changes that would break providers, however running provider tests - especially including compatibility tests takes a long time now and especially after we switched the committer PRs to run using public runners - adding compatibility tests to be run whenever provider tests ar run also does not help with speed. Instead we should defer to the "canary" build to catch such changes and rather than actively check all providers in PRs, the "canary" builds should be enough to catch any of such changes.
1 parent f399c4a commit ee97d7b

File tree

3 files changed

+32
-21
lines changed

3 files changed

+32
-21
lines changed

dev/breeze/src/airflow_breeze/global_constants.py

+5
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ def all_selective_test_types() -> tuple[str, ...]:
161161
return tuple(sorted(e.value for e in SelectiveUnitTestTypes))
162162

163163

164+
@lru_cache(maxsize=None)
165+
def all_selective_test_types_except_providers() -> tuple[str, ...]:
166+
return tuple(sorted(e.value for e in SelectiveUnitTestTypes if e != SelectiveUnitTestTypes.PROVIDERS))
167+
168+
164169
class SelectiveUnitTestTypes(Enum):
165170
ALWAYS = "Always"
166171
API = "API"

dev/breeze/src/airflow_breeze/utils/selective_checks.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
SelectiveUnitTestTypes,
5151
all_helm_test_packages,
5252
all_selective_test_types,
53+
all_selective_test_types_except_providers,
5354
)
5455
from airflow_breeze.utils.console import get_console
5556
from airflow_breeze.utils.exclude_from_matrix import excluded_combos
@@ -85,6 +86,10 @@
8586
"PythonVenv Serialization WWW"
8687
)
8788

89+
ALL_CI_SELECTIVE_TEST_TYPES_WITHOUT_PROVIDERS = (
90+
"API Always BranchExternalPython BranchPythonVenv CLI Core "
91+
"ExternalPython Operators Other PlainAsserts PythonVenv Serialization WWW"
92+
)
8893
ALL_PROVIDERS_SELECTIVE_TEST_TYPES = "Providers[-amazon,google] Providers[amazon] Providers[google]"
8994

9095

@@ -744,11 +749,12 @@ def _get_test_types_to_run(self, split_to_individual_providers: bool = False) ->
744749
break
745750
if count_remaining_files > 0:
746751
get_console().print(
747-
f"[warning]We should run all tests. There are {count_remaining_files} changed "
748-
"files that seems to fall into Core/Other category[/]"
752+
f"[warning]We should run all core tests except providers."
753+
f"There are {count_remaining_files} changed files that seems to fall "
754+
f"into Core/Other category[/]"
749755
)
750756
get_console().print(remaining_files)
751-
candidate_test_types.update(all_selective_test_types())
757+
candidate_test_types.update(all_selective_test_types_except_providers())
752758
else:
753759
if "Providers" in candidate_test_types or "API" in candidate_test_types:
754760
affected_providers = self._find_all_providers_affected(

dev/breeze/tests/test_selective_checks.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from airflow_breeze.utils.packages import get_available_packages
3434
from airflow_breeze.utils.selective_checks import (
3535
ALL_CI_SELECTIVE_TEST_TYPES,
36+
ALL_CI_SELECTIVE_TEST_TYPES_WITHOUT_PROVIDERS,
3637
ALL_PROVIDERS_SELECTIVE_TEST_TYPES,
3738
SelectiveChecks,
3839
)
@@ -1279,46 +1280,45 @@ def test_expected_output_pull_request_v2_7(
12791280
pytest.param(
12801281
("airflow/models/test.py",),
12811282
{
1282-
"affected-providers-list-as-string": ALL_PROVIDERS_AFFECTED,
12831283
"all-python-versions": "['3.8']",
12841284
"all-python-versions-list-as-string": "3.8",
12851285
"ci-image-build": "true",
12861286
"prod-image-build": "false",
12871287
"needs-helm-tests": "false",
12881288
"run-tests": "true",
12891289
"docs-build": "true",
1290-
"docs-list-as-string": ALL_DOCS_SELECTED_FOR_BUILD,
1290+
"docs-list-as-string": "apache-airflow",
12911291
"skip-pre-commits": "check-provider-yaml-valid,identity,lint-helm-chart,mypy-airflow,mypy-dev,mypy-docs,mypy-providers,ts-compile-format-lint-www",
12921292
"run-kubernetes-tests": "false",
12931293
"upgrade-to-newer-dependencies": "false",
1294-
"skip-provider-tests": "false",
1295-
"parallel-test-types-list-as-string": ALL_CI_SELECTIVE_TEST_TYPES,
1294+
"skip-provider-tests": "true",
1295+
"parallel-test-types-list-as-string": ALL_CI_SELECTIVE_TEST_TYPES_WITHOUT_PROVIDERS,
12961296
"needs-mypy": "true",
1297-
"mypy-folders": "['airflow', 'providers']",
1297+
"mypy-folders": "['airflow']",
12981298
},
1299-
id="Tests for all providers should run if model file changed",
1299+
id="Tests for all airflow core types except providers should run if model file changed",
13001300
),
13011301
pytest.param(
13021302
("airflow/file.py",),
13031303
{
1304-
"affected-providers-list-as-string": ALL_PROVIDERS_AFFECTED,
13051304
"all-python-versions": "['3.8']",
13061305
"all-python-versions-list-as-string": "3.8",
13071306
"ci-image-build": "true",
13081307
"prod-image-build": "false",
13091308
"needs-helm-tests": "false",
13101309
"run-tests": "true",
13111310
"docs-build": "true",
1312-
"docs-list-as-string": ALL_DOCS_SELECTED_FOR_BUILD,
1311+
"docs-list-as-string": "apache-airflow",
13131312
"skip-pre-commits": "check-provider-yaml-valid,identity,lint-helm-chart,mypy-airflow,mypy-dev,mypy-docs,mypy-providers,ts-compile-format-lint-www",
13141313
"run-kubernetes-tests": "false",
13151314
"upgrade-to-newer-dependencies": "false",
1316-
"skip-provider-tests": "false",
1317-
"parallel-test-types-list-as-string": ALL_CI_SELECTIVE_TEST_TYPES,
1315+
"skip-provider-tests": "true",
1316+
"parallel-test-types-list-as-string": ALL_CI_SELECTIVE_TEST_TYPES_WITHOUT_PROVIDERS,
13181317
"needs-mypy": "true",
1319-
"mypy-folders": "['airflow', 'providers']",
1318+
"mypy-folders": "['airflow']",
13201319
},
1321-
id="Tests for all providers should run if any other than API/WWW/CLI/Operators file changed.",
1320+
id="Tests for all airflow core types except providers should run if "
1321+
"any other than API/WWW/CLI/Operators file changed.",
13221322
),
13231323
],
13241324
)
@@ -1601,9 +1601,9 @@ def test_upgrade_to_newer_dependencies(
16011601
pytest.param(
16021602
("airflow/test.py",),
16031603
{
1604-
"docs-list-as-string": ALL_DOCS_SELECTED_FOR_BUILD,
1604+
"docs-list-as-string": "apache-airflow",
16051605
},
1606-
id="Core files changed. All provider docs should also be built",
1606+
id="Core files changed. Apache-Airflow docs should also be built",
16071607
),
16081608
pytest.param(
16091609
("docs/docker-stack/test.rst",),
@@ -1613,9 +1613,9 @@ def test_upgrade_to_newer_dependencies(
16131613
pytest.param(
16141614
("airflow/test.py", "chart/airflow/values.yaml"),
16151615
{
1616-
"docs-list-as-string": ALL_DOCS_SELECTED_FOR_BUILD,
1616+
"docs-list-as-string": "apache-airflow helm-chart",
16171617
},
1618-
id="Core files and helm chart files changed. All provider docs should be built",
1618+
id="Core files and helm chart files changed. Apache Airflow and helm chart docs to build",
16191619
),
16201620
pytest.param(
16211621
("chart/airflow/values.yaml",),
@@ -2033,11 +2033,11 @@ def test_provider_compatibility_checks(labels: tuple[str, ...], expected_outputs
20332033
("airflow/models/file.py",),
20342034
{
20352035
"needs-mypy": "true",
2036-
"mypy-folders": "['airflow', 'providers']",
2036+
"mypy-folders": "['airflow']",
20372037
},
20382038
"main",
20392039
(),
2040-
id="Airflow mypy checks on airflow files that can trigger provider tests",
2040+
id="Airflow mypy checks on airflow files with model changes.",
20412041
),
20422042
pytest.param(
20432043
("airflow/providers/a_file.py",),

0 commit comments

Comments
 (0)