tests: Get rid of netcat on the host and use Bash's /dev/tcp

The only remaining uses of nc now are in containers.

Signed-off-by: Ricardo Branco <rbranco@suse.de>
This commit is contained in:
Ricardo Branco
2025-08-28 17:40:48 +02:00
committed by Matt Heon
parent f8800b7fa8
commit 4e83155959
3 changed files with 4 additions and 4 deletions

View File

@ -338,7 +338,7 @@ EOF
# send a random string to the container. This will cause the container
# to output the string to its logs, then exit.
teststring=$(random_string 30)
echo "$teststring" | nc 127.0.0.1 $port_out
echo "$teststring" > /dev/tcp/127.0.0.1/$port_out
# Confirm that the container log output is the string we sent it.
run_podman wait $cid

View File

@ -153,7 +153,7 @@ load helpers.network
# emit random string, and check it
teststring=$(random_string 30)
echo "$teststring" | nc 127.0.0.1 $myport
echo "$teststring" > /dev/tcp/127.0.0.1/$myport
run_podman logs $cid
# Sigh. We can't check line-by-line, because 'nc' output order is
@ -296,7 +296,7 @@ load helpers.network
# emit random string, and check it
teststring=$(random_string 30)
echo "$teststring" | nc 127.0.0.1 $myport
echo "$teststring" > /dev/tcp/127.0.0.1/$myport
run_podman logs $cid
# Sigh. We can't check line-by-line, because 'nc' output order is

View File

@ -423,7 +423,7 @@ function wait_for_port() {
function tcp_port_probe() {
local address="${2:-0.0.0.0}"
: | nc "${address}" "${1}"
(exec echo -n >/dev/tcp/"$address/$1") >/dev/null 2>&1
}
### Pasta Helpers ##############################################################