summaryrefslogtreecommitdiff
path: root/test/system/200-pod.bats
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-09-08 14:48:24 -0400
committerGitHub <noreply@github.com>2021-09-08 14:48:24 -0400
commit26c8549ae3d4f5c3742d006e40a51080d5ae0746 (patch)
treefd5100db6dc89b39e55340a1a0562d92dea45067 /test/system/200-pod.bats
parent400799b58cd2c67aea4754d370415081e2d303c6 (diff)
parent1ff797e3621e7e370f53c4c71c9f40bb6a878936 (diff)
downloadpodman-26c8549ae3d4f5c3742d006e40a51080d5ae0746.tar.gz
podman-26c8549ae3d4f5c3742d006e40a51080d5ae0746.tar.bz2
podman-26c8549ae3d4f5c3742d006e40a51080d5ae0746.zip
Merge pull request #11486 from edsantiago/bats
system tests: new random_free_port helper
Diffstat (limited to 'test/system/200-pod.bats')
-rw-r--r--test/system/200-pod.bats18
1 files changed, 3 insertions, 15 deletions
diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats
index 266f91298..027abf9dc 100644
--- a/test/system/200-pod.bats
+++ b/test/system/200-pod.bats
@@ -76,11 +76,7 @@ function teardown() {
fi
# Randomly-assigned port in the 5xxx range
- for port in $(shuf -i 5000-5999);do
- if ! { exec 3<> /dev/tcp/127.0.0.1/$port; } &>/dev/null; then
- break
- fi
- done
+ port=$(random_free_port)
# Listener. This will exit as soon as it receives a message.
run_podman run -d --pod $podname $IMAGE nc -l -p $port
@@ -183,16 +179,8 @@ function random_ip() {
pod_id_file=${PODMAN_TMPDIR}/pod-id-file
# Randomly-assigned ports in the 5xxx and 6xxx range
- for port_in in $(shuf -i 5000-5999);do
- if ! { exec 3<> /dev/tcp/127.0.0.1/$port_in; } &>/dev/null; then
- break
- fi
- done
- for port_out in $(shuf -i 6000-6999);do
- if ! { exec 3<> /dev/tcp/127.0.0.1/$port_out; } &>/dev/null; then
- break
- fi
- done
+ port_in=$(random_free_port 5000-5999)
+ port_out=$(random_free_port 6000-6999)
# Create a pod with all the desired options
# FIXME: --ip=$ip fails: