potiuk commented on a change in pull request #14531:
URL: https://github.com/apache/airflow/pull/14531#discussion_r586582496
##########
File path: scripts/ci/testing/ci_run_airflow_testing.sh
##########
@@ -170,5 +161,282 @@ do
echo
"**********************************************************************************************"
run_airflow_testing_in_docker "${@}"
+}
+
+
+# Cleans up Docker before test execution. System prune should clean all the
temporary/unnamed images
+# And left-over volumes
+function cleanup_docker() {
+ echo
+ echo "System-prune docker"
+ echo
+ docker system prune --force --volumes
+ echo
+ echo "Check available space"
+ echo
+ df --human
+ echo
+ echo "Check available memory"
+ echo
+ free --human
+}
+
+# Prints status of a parallel test type. Returns 0 if the test type is still
running, 1 otherwise
+#
+# $1 - Test type
+#
+# The test_pids variable should contain mapping of test types to pids
+# NOTE: It might be surprise that local variables (like test_pids) are visible
to called functions
+# But this is how local variables in bash work (by design).
+function print_test_type_status() {
+ local test_type=$1
+ local pid="${test_pids[${test_type}]}"
+ local log_file="${CACHE_TMP_FILE_DIR}/output-${test_type}.log"
+ if ps -p "${pid}" >/dev/null 2>/dev/null; then
+ if [[ ${TEST_SHOW_ALL_OUTPUT_LINES_AS_THEY_APPEAR} != "true" ]]; then
+ echo "${COLOR_BLUE}Test type ${test_type} in progress (last
${TEST_SHOW_OUTPUT_LINES} lines of the output shown).${COLOR_RESET}"
+ echo
+ tail -${TEST_SHOW_OUTPUT_LINES} "${log_file}"
+ echo
+ echo
+ fi
+ return 0
+ else
+ if wait "${pid}"; then
+ echo
+ echo "${COLOR_GREEN}Test type: ${test_type}
succeeded.${COLOR_RESET}"
+ echo
+ return 1
+ else
+ echo
+ echo "${COLOR_RED}Test type: ${test_type} failed.${COLOR_RESET}"
+ echo
+ return 1
+ fi
+ fi
+}
+
+# Prints status of all parallel test types. Returns 0 if any of the tests are
still running, 1 otherwise
+function print_all_test_types_status() {
+ local still_running="false"
+ local test_type
+ echo "${COLOR_YELLOW}Progress for all tests:
${COLOR_BLUE}${TEST_TYPES}${COLOR_RESET}"
+ echo
+ for test_type in ${TEST_TYPES}
+ do
+ if print_test_type_status "${test_type}" ; then
+ still_running="true"
+ fi
+ done
+ if [[ ${still_running} == "true" ]]; then
+ return 0
+ fi
+ return 1
+}
+
+# Starts all test types in parallel
+# TEST_TYPES - list of all test types (it's not an array, it is space-separate
list)
+# ${@} - additional arguments to pass to test execution
+function start_test_types_in_parallel() {
+ local test_type
+ local database_port
+ start_end::group_start "Starting parallel tests: ${TEST_TYPES}"
+ for test_type in ${TEST_TYPES}
+ do
+ # Grabbing a free random port to use for database forwarding
+ database_port="$(python -c 'import socket; s=socket.socket();
s.bind(("", 0)); print(s.getsockname()[1])')";
+ echo
+ echo "Grabbed database port for forwarding: ${database_port}"
+ log_file="${CACHE_TMP_FILE_DIR}/output-${test_type}.log"
+ TEST_TYPE=${test_type} MYSQL_HOST_PORT="${database_port}"
POSTGRES_HOST_PORT="${database_port}" \
+ run_single_test_type "${@}" >"${log_file}" 2>&1 &
Review comment:
Yep. Fir stime for me as well. Interesting to see the that the current
PID does not work.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]