From 1ff797e3621e7e370f53c4c71c9f40bb6a878936 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Wed, 8 Sep 2021 10:57:24 -0600 Subject: system tests: new random_free_port helper Picks a pseudorandom open port within a range. Refactor existing instances of such code. Signed-off-by: Ed Santiago --- test/system/150-login.bats | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'test/system/150-login.bats') diff --git a/test/system/150-login.bats b/test/system/150-login.bats index b6c04db08..ed925044c 100644 --- a/test/system/150-login.bats +++ b/test/system/150-login.bats @@ -22,12 +22,7 @@ fi # Randomly-assigned port in the 5xxx range if [ -z "${PODMAN_LOGIN_REGISTRY_PORT}" ]; then - for port in $(shuf -i 5000-5999);do - if ! { exec 3<> /dev/tcp/127.0.0.1/$port; } &>/dev/null; then - export PODMAN_LOGIN_REGISTRY_PORT=$port - break - fi - done + export PODMAN_LOGIN_REGISTRY_PORT=$(random_free_port) fi # Override any user-set path to an auth file -- cgit v1.2.3-54-g00ecf