This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new bc7e471cda Fix selective checks skipping provider tests in non main 
branch (#31821)
bc7e471cda is described below

commit bc7e471cdae73a3c46ef89d17dbc1a54212b9291
Author: Jarek Potiuk <[email protected]>
AuthorDate: Fri Jun 9 23:21:00 2023 +0200

    Fix selective checks skipping provider tests in non main branch (#31821)
    
    When CI runs in non-main branch, some provider precommits and provider
    tests should be disabled. There was a typo that prevented this from
    happening, also names of the pre-commits changed.
---
 .github/workflows/ci.yml                           |  2 +-
 .../src/airflow_breeze/utils/selective_checks.py   | 25 +++++++++++++++-------
 dev/breeze/tests/test_selective_checks.py          |  1 +
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index cd15ad08cf..5671422022 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -103,7 +103,7 @@ jobs:
       mysql-exclude: ${{ steps.selective-checks.outputs.mysql-exclude }}
       mssql-exclude: ${{ steps.selective-checks.outputs.mssql-exclude }}
       sqlite-exclude: ${{ steps.selective-checks.outputs.sqlite-exclude }}
-      skip-provider-tests: ${{ 
steps.source-run-info.outputs.skip-provider-tests }}
+      skip-provider-tests: ${{ 
steps.selective-checks.outputs.skip-provider-tests }}
       run-tests: ${{ steps.selective-checks.outputs.run-tests }}
       run-amazon-tests: ${{ steps.selective-checks.outputs.run-amazon-tests }}
       run-www-tests: ${{ steps.selective-checks.outputs.run-www-tests }}
diff --git a/dev/breeze/src/airflow_breeze/utils/selective_checks.py 
b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
index c34a168d63..4c2ee6c304 100644
--- a/dev/breeze/src/airflow_breeze/utils/selective_checks.py
+++ b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
@@ -574,6 +574,9 @@ class SelectiveChecks:
         return "allow suspended provider changes" not in self._pr_labels
 
     def _get_test_types_to_run(self) -> list[str]:
+        if self.full_tests_needed:
+            return list(all_selective_test_types())
+
         candidate_test_types: set[str] = {"Always"}
         matched_files: set[str] = set()
         matched_files.update(
@@ -656,10 +659,7 @@ class SelectiveChecks:
     def parallel_test_types_list_as_string(self) -> str | None:
         if not self.run_tests:
             return None
-        if self.full_tests_needed:
-            current_test_types = set(all_selective_test_types())
-        else:
-            current_test_types = set(self._get_test_types_to_run())
+        current_test_types = set(self._get_test_types_to_run())
         if self._default_branch != "main":
             test_types_to_remove: set[str] = set()
             for test_type in current_test_types:
@@ -735,13 +735,22 @@ class SelectiveChecks:
 
     @cached_property
     def skip_pre_commits(self) -> str:
-        return "identity" if self._default_branch == "main" else 
"identity,check-airflow-2-2-compatibility"
+        return (
+            "identity"
+            if self._default_branch == "main"
+            else "identity,check-airflow-provider-compatibility,"
+            "check-extra-packages-references,check-provider-yaml-valid"
+        )
 
     @cached_property
     def skip_provider_tests(self) -> bool:
-        return self._default_branch != "main" or not any(
-            test_type.startswith("Providers") for test_type in 
self._get_test_types_to_run()
-        )
+        if self._default_branch != "main":
+            return True
+        if self.full_tests_needed:
+            return False
+        if any(test_type.startswith("Providers") for test_type in 
self._get_test_types_to_run()):
+            return False
+        return True
 
     @cached_property
     def cache_directive(self) -> str:
diff --git a/dev/breeze/tests/test_selective_checks.py 
b/dev/breeze/tests/test_selective_checks.py
index 06b404b284..4869d70739 100644
--- a/dev/breeze/tests/test_selective_checks.py
+++ b/dev/breeze/tests/test_selective_checks.py
@@ -485,6 +485,7 @@ def test_expected_output_pull_request_main(
                     "docs-filter-list-as-string": "--package-filter 
apache-airflow "
                     "--package-filter docker-stack",
                     "full-tests-needed": "true",
+                    "skip-provider-tests": "true",
                     "upgrade-to-newer-dependencies": "false",
                     "parallel-test-types-list-as-string": "Core Other WWW API 
Always CLI",
                 },

Reply via email to