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

ephraimanierobi pushed a commit to branch v2-6-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 07ec2485b38968ffba4ff9a2e7c192ce1d4c8873
Author: Jarek Potiuk <[email protected]>
AuthorDate: Mon Apr 17 21:14:43 2023 +0200

    Introduce consistency of package sequence for "Other" test type (#30682)
    
    When packages for "Other" test type are calculated, the list of
    all test folders is generated and they are compared with the
    packages previously selected by the "predefined" test types. This
    is done via `find` method that returns the folders in arbitrary
    order, mostly depending on the sequence the folders were created.
    
    In case the tests from some packages have some side-effects that
    impact tests in other packages (obviously not something that is
    desired), this might end up that the tests succeed in one
    environment, but fail in another. This happened for example
    in case of #30362 that had cross-package side-effect later
    fixed in #30588. There - results of "Other" test type depended
    on where the tests were executed.
    
    This PR sorts the find output so it is always in consistent order.
    we are using ASCII for package names and the test types are
    derived in the same Docker CI image with the same LOCALE, so it
    should guarantee that the output of packages for "Other" test type
    should be always consistent.
    
    (cherry picked from commit c858cd28a2e80c35d5f470f0765aa133f17b4820)
---
 Dockerfile.ci                   | 5 ++++-
 scripts/docker/entrypoint_ci.sh | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Dockerfile.ci b/Dockerfile.ci
index dfd931cfdc..74dc3ae981 100644
--- a/Dockerfile.ci
+++ b/Dockerfile.ci
@@ -954,7 +954,10 @@ declare -a SELECTED_TESTS CLI_TESTS API_TESTS 
PROVIDERS_TESTS CORE_TESTS WWW_TES
 
 function find_all_other_tests() {
     local all_tests_dirs
-    all_tests_dirs=$(find "tests" -type d ! -name '__pycache__')
+    # The output of the find command should be sorted to make sure that the 
order is always the same
+    # when we run the tests, to avoid cross-package side effects causing 
different test results
+    # in different environments. See 
https://github.com/apache/airflow/pull/30588 for example.
+    all_tests_dirs=$(find "tests" -type d ! -name '__pycache__' | sort)
     all_tests_dirs=$(echo "${all_tests_dirs}" | sed "/tests$/d" )
     all_tests_dirs=$(echo "${all_tests_dirs}" | sed "/tests\/dags/d" )
     local path
diff --git a/scripts/docker/entrypoint_ci.sh b/scripts/docker/entrypoint_ci.sh
index b33faaf74b..840ea84a53 100755
--- a/scripts/docker/entrypoint_ci.sh
+++ b/scripts/docker/entrypoint_ci.sh
@@ -383,7 +383,10 @@ declare -a SELECTED_TESTS CLI_TESTS API_TESTS 
PROVIDERS_TESTS CORE_TESTS WWW_TES
 # - so that we do not skip any in the future if new directories are added
 function find_all_other_tests() {
     local all_tests_dirs
-    all_tests_dirs=$(find "tests" -type d ! -name '__pycache__')
+    # The output of the find command should be sorted to make sure that the 
order is always the same
+    # when we run the tests, to avoid cross-package side effects causing 
different test results
+    # in different environments. See 
https://github.com/apache/airflow/pull/30588 for example.
+    all_tests_dirs=$(find "tests" -type d ! -name '__pycache__' | sort)
     all_tests_dirs=$(echo "${all_tests_dirs}" | sed "/tests$/d" )
     all_tests_dirs=$(echo "${all_tests_dirs}" | sed "/tests\/dags/d" )
     local path

Reply via email to