Skip to content
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

Fix problems with missing selective checks on new types of unit tests #36372

Merged
merged 1 commit into from
Dec 22, 2023
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
58 changes: 30 additions & 28 deletions dev/breeze/src/airflow_breeze/utils/selective_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,33 +223,42 @@ def __hash__(self):
}
)

PYTHON_OPERATOR_FILES = [
r"^airflow/operators/python.py",
r"^tests/operators/test_python.py",
]

TEST_TYPE_MATCHES = HashableDict(
{
SelectiveUnitTestTypes.API: [
r"^airflow/api",
r"^airflow/api_connexion",
r"^tests/api",
r"^tests/api_connexion",
r"^airflow/api/",
r"^airflow/api_connexion/",
r"^airflow/api_internal/",
r"^tests/api/",
r"^tests/api_connexion/",
r"^tests/api_internal/",
],
SelectiveUnitTestTypes.CLI: [
r"^airflow/cli",
r"^tests/cli",
r"^airflow/cli/",
r"^tests/cli/",
],
SelectiveUnitTestTypes.OPERATORS: [
r"^airflow/operators",
r"^tests/operators",
r"^airflow/operators/",
r"^tests/operators/",
],
SelectiveUnitTestTypes.PROVIDERS: [
r"^airflow/providers/",
r"^tests/system/providers/",
r"^tests/providers/",
],
SelectiveUnitTestTypes.PYTHON_VENV: [
r"^tests/operators/test_python.py",
],
SelectiveUnitTestTypes.BRANCH_PYTHON_VENV: [
r"^tests/operators/test_python.py",
SelectiveUnitTestTypes.SERIALIZATION: [
r"^airflow/serialization/",
r"^tests/serialization/",
],
SelectiveUnitTestTypes.PYTHON_VENV: PYTHON_OPERATOR_FILES,
SelectiveUnitTestTypes.BRANCH_PYTHON_VENV: PYTHON_OPERATOR_FILES,
SelectiveUnitTestTypes.EXTERNAL_PYTHON: PYTHON_OPERATOR_FILES,
SelectiveUnitTestTypes.EXTERNAL_BRANCH_PYTHON: PYTHON_OPERATOR_FILES,
SelectiveUnitTestTypes.WWW: [r"^airflow/www", r"^tests/www"],
}
)
Expand Down Expand Up @@ -652,21 +661,14 @@ def _get_test_types_to_run(self) -> list[str]:

candidate_test_types: set[str] = {"Always"}
matched_files: set[str] = set()
matched_files.update(
self._select_test_type_if_matching(candidate_test_types, SelectiveUnitTestTypes.WWW)
)
matched_files.update(
self._select_test_type_if_matching(candidate_test_types, SelectiveUnitTestTypes.PROVIDERS)
)
matched_files.update(
self._select_test_type_if_matching(candidate_test_types, SelectiveUnitTestTypes.CLI)
)
matched_files.update(
self._select_test_type_if_matching(candidate_test_types, SelectiveUnitTestTypes.OPERATORS)
)
matched_files.update(
self._select_test_type_if_matching(candidate_test_types, SelectiveUnitTestTypes.API)
)
for test_type in SelectiveUnitTestTypes:
if test_type not in [
SelectiveUnitTestTypes.ALWAYS,
SelectiveUnitTestTypes.CORE,
SelectiveUnitTestTypes.OTHER,
SelectiveUnitTestTypes.PLAIN_ASSERTS,
]:
matched_files.update(self._select_test_type_if_matching(candidate_test_types, test_type))

kubernetes_files = self._matching_files(
FileGroupForCi.KUBERNETES_FILES, CI_FILE_GROUP_MATCHES, CI_FILE_GROUP_EXCLUDES
Expand Down
47 changes: 47 additions & 0 deletions dev/breeze/tests/test_selective_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,53 @@ def assert_outputs_are_printed(expected_outputs: dict[str, str], stderr: str):
id="Only Operator tests and DOCS should run",
)
),
(
pytest.param(
("airflow/operators/python.py",),
{
"affected-providers-list-as-string": None,
"all-python-versions": "['3.8']",
"all-python-versions-list-as-string": "3.8",
"python-versions": "['3.8']",
"python-versions-list-as-string": "3.8",
"ci-image-build": "true",
"prod-image-build": "false",
"needs-helm-tests": "false",
"run-tests": "true",
"run-amazon-tests": "false",
"docs-build": "true",
"skip-pre-commits": "check-provider-yaml-valid,identity,lint-helm-chart,mypy-dev,"
"mypy-docs,mypy-providers,ts-compile-format-lint-www",
"upgrade-to-newer-dependencies": "false",
"parallel-test-types-list-as-string": "Always BranchExternalPython BranchPythonVenv "
"ExternalPython Operators PythonVenv",
},
id="Only Python tests",
)
),
(
pytest.param(
("airflow/serialization/python.py",),
{
"affected-providers-list-as-string": None,
"all-python-versions": "['3.8']",
"all-python-versions-list-as-string": "3.8",
"python-versions": "['3.8']",
"python-versions-list-as-string": "3.8",
"ci-image-build": "true",
"prod-image-build": "false",
"needs-helm-tests": "false",
"run-tests": "true",
"run-amazon-tests": "false",
"docs-build": "true",
"skip-pre-commits": "check-provider-yaml-valid,identity,lint-helm-chart,mypy-dev,"
"mypy-docs,mypy-providers,ts-compile-format-lint-www",
"upgrade-to-newer-dependencies": "false",
"parallel-test-types-list-as-string": "Always Serialization",
},
id="Only Serialization tests",
)
),
(
pytest.param(
(
Expand Down