From 6a979c14b2ec991639502e06f1acc83821dbf6ac Mon Sep 17 00:00:00 2001
From: Jarek Potiuk <jarek@potiuk.com>
Date: Tue, 12 Oct 2021 10:44:25 +0200
Subject: [PATCH] Remove adding of "test-run" variables to dc_ci script

The RUN_*TEST variables are not part of the environment
so they are not set when the dc_ci is generated they are
overridden by Breeze when particular commands are executed.
Therefore we should not hard-code those values in dc_ci script
(this is useful for debugging to have the script but it is only
there for environment configuration)
---
 breeze                                                     | 5 ++---
 scripts/ci/docker-compose/_docker.env                      | 2 +-
 scripts/ci/docker-compose/base.yml                         | 2 +-
 scripts/ci/libraries/_initialization.sh                    | 6 +++---
 scripts/ci/testing/ci_run_single_airflow_test_in_docker.sh | 4 ++--
 scripts/in_container/entrypoint_ci.sh                      | 4 ++--
 6 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/breeze b/breeze
index 72bb8da190f77..09b7ab2b5684a 100755
--- a/breeze
+++ b/breeze
@@ -647,9 +647,6 @@ export ENABLED_SYSTEMS="${ENABLED_SYSTEMS}"
 export GITHUB_ACTIONS="${GITHUB_ACTIONS}"
 export ISSUE_ID="${ISSUE_ID}"
 export NUM_RUNS="${NUM_RUNS}"
-export RUN_TESTS="${RUN_TESTS}"
-export RUN_INTEGRATION_TESTS="${RUN_INTEGRATION_TESTS}"
-export RUN_SYSTEM_TESTS="${RUN_SYSTEM_TESTS}"
 export VERSION_SUFFIX_FOR_SVN="${VERSION_SUFFIX_FOR_SVN}"
 export VERSION_SUFFIX_FOR_PYPI="${VERSION_SUFFIX_FOR_PYPI}"
 docker-compose ${command}
@@ -3480,6 +3477,8 @@ function breeze::run_breeze_command() {
         docker_engine_resources::check_all_resources
         export RUN_TESTS="true"
         readonly RUN_TESTS
+        export ENABLED_INTEGRATIONS="${INTEGRATIONS[*]}"
+        export LIST_OF_INTEGRATION_TESTS_TO_RUN="${INTEGRATIONS[*]}"
         ${run_command} "${BUILD_CACHE_DIR}/${DOCKER_COMPOSE_RUN_SCRIPT_FOR_CI}" run --service-ports --rm airflow "$@"
         ;;
     run_docker_compose)
diff --git a/scripts/ci/docker-compose/_docker.env b/scripts/ci/docker-compose/_docker.env
index a4e017872c53b..08fb37cf076ee 100644
--- a/scripts/ci/docker-compose/_docker.env
+++ b/scripts/ci/docker-compose/_docker.env
@@ -53,7 +53,7 @@ PRINT_INFO_FROM_SCRIPTS
 PYTHONDONTWRITEBYTECODE
 PYTHON_MAJOR_MINOR_VERSION
 RUN_TESTS
-RUN_INTEGRATION_TESTS
+LIST_OF_INTEGRATION_TESTS_TO_RUN
 RUN_SYSTEM_TESTS
 START_AIRFLOW
 TEST_TYPE
diff --git a/scripts/ci/docker-compose/base.yml b/scripts/ci/docker-compose/base.yml
index 4ecf6ee3bcb64..809ba0887c9c4 100644
--- a/scripts/ci/docker-compose/base.yml
+++ b/scripts/ci/docker-compose/base.yml
@@ -66,7 +66,7 @@ services:
       - PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
       - PYTHON_MAJOR_MINOR_VERSION=${PYTHON_MAJOR_MINOR_VERSION}
       - RUN_TESTS=${RUN_TESTS}
-      - RUN_INTEGRATION_TESTS=${RUN_INTEGRATION_TESTS}
+      - LIST_OF_INTEGRATION_TESTS_TO_RUN=${LIST_OF_INTEGRATION_TESTS_TO_RUN}
       - RUN_SYSTEM_TESTS=${RUN_SYSTEM_TESTS}
       - START_AIRFLOW=${START_AIRFLOW}
       - TEST_TYPE=${TEST_TYPE}
diff --git a/scripts/ci/libraries/_initialization.sh b/scripts/ci/libraries/_initialization.sh
index 31e17e45131fd..d5602e5c16664 100644
--- a/scripts/ci/libraries/_initialization.sh
+++ b/scripts/ci/libraries/_initialization.sh
@@ -594,10 +594,10 @@ function initialization::initialize_test_variables() {
     export RUN_TESTS=${RUN_TESTS:="false"}
 
     # Do not run integration tests by default
-    export RUN_INTEGRATION_TESTS=${RUN_INTEGRATION_TESTS:="false"}
+    export LIST_OF_INTEGRATION_TESTS_TO_RUN=${LIST_OF_INTEGRATION_TESTS_TO_RUN:=""}
 
-    # Do not run system tests by default
-    export RUN_SYSTEM_TESTS=${RUN_SYSTEM_TESTS:="false"}
+    # Do not run system tests by default (they can be enabled by setting the RUN_SYSTEM_TESTS variable to "true")
+    export RUN_SYSTEM_TESTS=${RUN_SYSTEM_TESTS:=""}
 
 }
 
diff --git a/scripts/ci/testing/ci_run_single_airflow_test_in_docker.sh b/scripts/ci/testing/ci_run_single_airflow_test_in_docker.sh
index f2af0b92c3c8f..615ce21437664 100755
--- a/scripts/ci/testing/ci_run_single_airflow_test_in_docker.sh
+++ b/scripts/ci/testing/ci_run_single_airflow_test_in_docker.sh
@@ -51,10 +51,10 @@ function prepare_tests() {
 
     if [[ ${TEST_TYPE:=} == "Integration" ]]; then
         export ENABLED_INTEGRATIONS="${AVAILABLE_INTEGRATIONS}"
-        export RUN_INTEGRATION_TESTS="${AVAILABLE_INTEGRATIONS}"
+        export LIST_OF_INTEGRATION_TESTS_TO_RUN="${AVAILABLE_INTEGRATIONS}"
     else
         export ENABLED_INTEGRATIONS=""
-        export RUN_INTEGRATION_TESTS=""
+        export LIST_OF_INTEGRATION_TESTS_TO_RUN=""
     fi
 
     for _INT in ${ENABLED_INTEGRATIONS}
diff --git a/scripts/in_container/entrypoint_ci.sh b/scripts/in_container/entrypoint_ci.sh
index 0e09c8aa4e61d..3858c1c0f25ba 100755
--- a/scripts/in_container/entrypoint_ci.sh
+++ b/scripts/in_container/entrypoint_ci.sh
@@ -326,9 +326,9 @@ fi
 readonly SELECTED_TESTS CLI_TESTS API_TESTS PROVIDERS_TESTS CORE_TESTS WWW_TESTS \
     ALL_TESTS ALL_PRESELECTED_TESTS
 
-if [[ -n ${RUN_INTEGRATION_TESTS=} ]]; then
+if [[ -n ${LIST_OF_INTEGRATION_TESTS_TO_RUN=} ]]; then
     # Integration tests
-    for INT in ${RUN_INTEGRATION_TESTS}
+    for INT in ${LIST_OF_INTEGRATION_TESTS_TO_RUN}
     do
         EXTRA_PYTEST_ARGS+=("--integration" "${INT}")
     done
