diff --git a/test/system/150-login.bats b/test/system/150-login.bats index 7851ee0448..95d1c8bb2f 100644 --- a/test/system/150-login.bats +++ b/test/system/150-login.bats @@ -344,7 +344,7 @@ function _test_skopeo_credential_sharing() { fi # Make sure socket is closed - if ! port_is_free $PODMAN_LOGIN_REGISTRY_PORT; then + if tcp_port_probe $PODMAN_LOGIN_REGISTRY_PORT; then die "Socket still seems open" fi } diff --git a/test/system/helpers.network.bash b/test/system/helpers.network.bash index 52927b8c72..a88db0c615 100644 --- a/test/system/helpers.network.bash +++ b/test/system/helpers.network.bash @@ -286,3 +286,12 @@ function wait_for_port() { die "Timed out waiting for $host:$port" } + +# tcp_port_probe() - Check if a TCP port has an active listener +# $1: Port number +# $2: Optional address, 0.0.0.0 by default +function tcp_port_probe() { + local address="${2:-0.0.0.0}" + + : | nc "${address}" "${1}" +}