spuru9 commented on code in PR #29222:
URL: https://github.com/apache/flink/pull/29222#discussion_r4038805381
##########
flink-end-to-end-tests/test-scripts/common.sh:
##########
@@ -899,6 +899,34 @@ function wait_for_restart_to_complete {
done
}
+###################################
+# Waits until a docker container reports itself as running.
+#
+# Arguments:
+# $1 - the container id
+# $2 - timeout in seconds, 60 by default
+# Returns:
+# 0 once the container is running, 1 if it is not running within the timeout
+###################################
+function wait_for_container_running {
+ local container_id=$1
+ local timeout=${2:-60}
+
+ local i
+ for i in $(seq 1 $((timeout * 10))); do
+ # The comparison has to be a string comparison: [[ -ne ]] compares
arithmetically, and
+ # there every non-numeric value is 0, so "false" and the empty output
of a failed inspect
+ # both compare equal to "true".
+ if [[ "$(docker inspect -f '{{.State.Running}}' "${container_id}"
2>/dev/null)" == "true" ]]; then
+ return 0
+ fi
+ sleep 0.1
Review Comment:
optional qq: though not a issue in happy scenario, isnt 0.1s a little too
less of sleep? Maybe 1s.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]