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

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

commit 7902718102d6b99473dee450bcf41ed5f98ef09f
Author: Jarek Potiuk <[email protected]>
AuthorDate: Thu Jun 18 21:59:52 2020 +0200

    Fixes Breeze 'tests' command (#9384)
    
    Fixes the 'tests' command allows to run individual tests immediately
    from the host without entering the container. It's been broken
    in 7c12a9d4e0b6c1e01fee6ab227a6e25b5aa5b157
    
    (cherry picked from commit 6484dea15b9962dd6a714316c68e5e4aadb84382)
---
 breeze                                   | 12 ++++++------
 scripts/ci/in_container/entrypoint_ci.sh | 19 ++++++++++---------
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/breeze b/breeze
index 118703d..74c0974 100755
--- a/breeze
+++ b/breeze
@@ -417,9 +417,8 @@ EOF
 function prepare_command_file() {
     local FILE="${1}"
     local CMD="${2}"
-    local TESTS="${3}"
-    local COMPOSE_FILE="${4}"
-    local AIRFLOW_IMAGE="${5}"
+    local COMPOSE_FILE="${3}"
+    local AIRFLOW_IMAGE="${4}"
     cat <<EOF > "${FILE}"
 #!/usr/bin/env bash
 if [[ \${VERBOSE} == "true" ]]; then
@@ -443,7 +442,6 @@ export 
PYTHON_MAJOR_MINOR_VERSION="${PYTHON_MAJOR_MINOR_VERSION}"
 export BACKEND="${BACKEND}"
 export AIRFLOW_VERSION="${AIRFLOW_VERSION}"
 export INSTALL_AIRFLOW_VERSION="${INSTALL_AIRFLOW_VERSION}"
-export RUN_TESTS="${TESTS}"
 export WEBSERVER_HOST_PORT="${WEBSERVER_HOST_PORT}"
 export POSTGRES_HOST_PORT="${POSTGRES_HOST_PORT}"
 export POSTGRES_VERSION="${POSTGRES_VERSION}"
@@ -519,11 +517,11 @@ function prepare_command_files() {
 
     # Prepare script for "run docker compose CI command"
     prepare_command_file "${BUILD_CACHE_DIR}/${LAST_DC_CI_FILE}" \
-        "\"\${@}\"" "false" "${COMPOSE_CI_FILE}" "${AIRFLOW_CI_IMAGE}"
+        "\"\${@}\"" "${COMPOSE_CI_FILE}" "${AIRFLOW_CI_IMAGE}"
 
     # Prepare script for "run docker compose PROD command"
     prepare_command_file "${BUILD_CACHE_DIR}/${LAST_DC_PROD_FILE}" \
-        "\"\${@}\"" "false" "${COMPOSE_PROD_FILE}" "${AIRFLOW_PROD_IMAGE}"
+        "\"\${@}\"" "${COMPOSE_PROD_FILE}" "${AIRFLOW_PROD_IMAGE}"
 }
 
 # Prints detailed help for all commands and flgas. Used to generate 
documentation added to BREEZE.rst
@@ -884,6 +882,7 @@ function parse_arguments() {
           LAST_SUBCOMMAND="${1}"
           if [[ $# -lt 2 ]]; then
             RUN_HELP="true"
+          else
             shift
           fi
           COMMAND_TO_RUN="run_tests" ;;
@@ -1889,6 +1888,7 @@ function run_breeze_command {
                 "/opt/airflow/scripts/ci/in_container/entrypoint_exec.sh" 
"${@}"
             ;;
         run_tests)
+            export RUN_TESTS="true"
             "${BUILD_CACHE_DIR}/${LAST_DC_CI_FILE}" run --service-ports --rm 
airflow "$@"
             ;;
         run_docker_compose)
diff --git a/scripts/ci/in_container/entrypoint_ci.sh 
b/scripts/ci/in_container/entrypoint_ci.sh
index 1a753cf..2ea5a14 100755
--- a/scripts/ci/in_container/entrypoint_ci.sh
+++ b/scripts/ci/in_container/entrypoint_ci.sh
@@ -41,7 +41,8 @@ fi
 
 echo
 
-RUN_TESTS=${RUN_TESTS:="true"}
+RUN_TESTS=${RUN_TESTS:="false"}
+CI=${CI:="false"}
 INSTALL_AIRFLOW_VERSION="${INSTALL_AIRFLOW_VERSION:=""}"
 
 if [[ ${AIRFLOW_VERSION} == *1.10* || ${INSTALL_AIRFLOW_VERSION} == *1.10* ]]; 
then
@@ -149,13 +150,13 @@ cd "${AIRFLOW_SOURCES}"
 
 set +u
 # If we do not want to run tests, we simply drop into bash
-if [[ "${RUN_TESTS:=false}" != "true" ]]; then
+if [[ "${RUN_TESTS}" != "true" ]]; then
     exec /bin/bash "${@}"
 fi
 set -u
 
 if [[ "${CI}" == "true" ]]; then
-    CI_ARGS=(
+    EXTRA_PYTEST_ARGS=(
         "--verbosity=0"
         "--strict-markers"
         "--instafail"
@@ -169,7 +170,7 @@ if [[ "${CI}" == "true" ]]; then
         "--pythonwarnings=ignore::PendingDeprecationWarning"
         )
 else
-    CI_ARGS=()
+    EXTRA_PYTEST_ARGS=()
 fi
 
 declare -a TESTS_TO_RUN
@@ -182,18 +183,18 @@ fi
 if [[ -n ${RUN_INTEGRATION_TESTS:=""} ]]; then
     for INT in ${RUN_INTEGRATION_TESTS}
     do
-        CI_ARGS+=("--integration" "${INT}")
+        EXTRA_PYTEST_ARGS+=("--integration" "${INT}")
     done
-    CI_ARGS+=("-rpfExX")
+    EXTRA_PYTEST_ARGS+=("-rpfExX")
 elif [[ ${ONLY_RUN_LONG_RUNNING_TESTS:=""} == "true" ]]; then
-    CI_ARGS+=(
+    EXTRA_PYTEST_ARGS+=(
         "-m" "long_running"
         "--include-long-running"
         "--verbosity=1"
         "--reruns" "3"
         "--timeout" "90")
 elif [[ ${ONLY_RUN_QUARANTINED_TESTS:=""} == "true" ]]; then
-    CI_ARGS+=(
+    EXTRA_PYTEST_ARGS+=(
         "-m" "quarantined"
         "--include-quarantined"
         "--verbosity=1"
@@ -201,7 +202,7 @@ elif [[ ${ONLY_RUN_QUARANTINED_TESTS:=""} == "true" ]]; then
         "--timeout" "90")
 fi
 
-ARGS=("${CI_ARGS[@]}" "${TESTS_TO_RUN[@]}")
+ARGS=("${EXTRA_PYTEST_ARGS[@]}" "${TESTS_TO_RUN[@]}")
 
 if [[ ${RUN_SYSTEM_TESTS:="false"} == "true" ]]; then
     "${MY_DIR}/run_system_tests.sh" "${ARGS[@]}"

Reply via email to