From a741299efcc8982ce3e40e5de58c3d3e0f5309d5 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Fri, 23 Dec 2022 10:43:28 +0100 Subject: [PATCH] fix `podman system connection - tcp` flake The test was only waiting for the port to be ready but that doesn't imply the server being ready to serve requests. Hence, add a loop waiting for the `info` call to succeed. Fixes: #16916 Signed-off-by: Valentin Rothberg --- test/system/272-system-connection.bats | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/system/272-system-connection.bats b/test/system/272-system-connection.bats index c9ed9390dd..5dd045ee73 100644 --- a/test/system/272-system-connection.bats +++ b/test/system/272-system-connection.bats @@ -112,9 +112,17 @@ $c2[ ]\+tcp://localhost:54321[ ]\+true" \ --runroot ${PODMAN_TMPDIR}/runroot \ system service -t 99 tcp://localhost:$_SERVICE_PORT & _SERVICE_PID=$! + # Wait for the port and the podman-service to be ready. wait_for_port localhost $_SERVICE_PORT - - _run_podman_remote info --format '{{.Host.RemoteSocket.Path}}' + local timeout=10 + while [[ $timeout -gt 1 ]]; do + _run_podman_remote ? info --format '{{.Host.RemoteSocket.Path}}' + if [[ $status == 0 ]]; then + break + fi + sleep 1 + let timeout=$timeout-1 + done is "$output" "tcp://localhost:$_SERVICE_PORT" \ "podman info works, and talks to the correct server"