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

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

commit d0cca79fd49e55cef8adb1a193eb41151d9538b4
Author: Niko <[email protected]>
AuthorDate: Tue Jan 18 12:19:33 2022 -0800

    Fix errors thrown by some versions of Bash v4 (#20932)
    
    In some versions of Bash V4, accessing an array that's only been initted
    but contains no values can throw an error (specifically if -u is set).
    So wrap access in an if check first.
    See more details here: https://stackoverflow.com/a/58261136/1055702
    
    (cherry picked from commit acd9811cfbb01b95e76caf3d60b5a788ca3f5fc5)
---
 scripts/ci/testing/ci_run_airflow_testing.sh | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/scripts/ci/testing/ci_run_airflow_testing.sh 
b/scripts/ci/testing/ci_run_airflow_testing.sh
index c3bee5e..57b133e 100755
--- a/scripts/ci/testing/ci_run_airflow_testing.sh
+++ b/scripts/ci/testing/ci_run_airflow_testing.sh
@@ -110,14 +110,19 @@ function run_all_test_types_in_parallel() {
     # Run all tests that should run in parallel (from test_types_to_run 
variable)
     run_test_types_in_parallel "${@}"
 
-    # if needed run remaining tests sequentially
-    for sequential_test in "${sequential_tests[@]}"; do
-        parallel::cleanup_runner
-        test_types_to_run="${sequential_test}"
-        run_test_types_in_parallel "${@}"
-    done
+    # Check if sequential_tests contains any values since accessing an empty 
(and only initted) array throws an
+    # error in some versions of Bash 4
+    if [[ ${sequential_tests[0]+"${sequential_tests[@]}"} ]]
+    then
+        # If needed run remaining tests sequentially
+        for sequential_test in "${sequential_tests[@]}"; do
+            parallel::cleanup_runner
+            test_types_to_run="${sequential_test}"
+            run_test_types_in_parallel "${@}"
+        done
+    fi
     set -e
-    # this will exit with error code in case some of the non-Quarantined tests 
failed
+    # This will exit with error code in case some of the non-Quarantined tests 
failed
     parallel::print_job_summary_and_return_status_code
 }
 

Reply via email to