From fa18fce7e818eacc748818b447113e2baf17dc07 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Thu, 13 Jun 2019 09:27:58 -0600 Subject: [PATCH] start_registry: wait for registry to be ready The usual 'podman run -d' race condition: we've been forking off the container but not actually making sure it's up; this leads to flakes in which we try (and fail) to access it. Solution: use curl to check the port; we will expect a zero exit status once we can connect. Time out at ten seconds. Resolves: #675 Signed-off-by: Ed Santiago --- systemtest/helpers.bash | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/systemtest/helpers.bash b/systemtest/helpers.bash index e15342fb..d30e0676 100644 --- a/systemtest/helpers.bash +++ b/systemtest/helpers.bash @@ -310,6 +310,18 @@ start_registry() { fi $PODMAN run -d --name $name "${reg_args[@]}" registry:2 + + # Wait for registry to actually come up + timeout=10 + while [[ $timeout -ge 1 ]]; do + if curl localhost:$port/; then + return + fi + + timeout=$(expr $timeout - 1) + sleep 1 + done + die "Timed out waiting for registry container to respond on :$port" } # END helpers for starting/stopping registries