Skip to content

Commit 43305b6

Browse files
Merge pull request #26921 from ricardobranco777/bye_netcat
tests: Get rid of netcat on the host and use Bash's /dev/tcp
2 parents b5a0c49 + 3effff4 commit 43305b6

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

test/system/200-pod.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ EOF
338338
# send a random string to the container. This will cause the container
339339
# to output the string to its logs, then exit.
340340
teststring=$(random_string 30)
341-
echo "$teststring" | nc 127.0.0.1 $port_out
341+
echo "$teststring" > /dev/tcp/127.0.0.1/$port_out
342342

343343
# Confirm that the container log output is the string we sent it.
344344
run_podman wait $cid

test/system/500-networking.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ load helpers.network
153153

154154
# emit random string, and check it
155155
teststring=$(random_string 30)
156-
echo "$teststring" | nc 127.0.0.1 $myport
156+
echo "$teststring" > /dev/tcp/127.0.0.1/$myport
157157

158158
run_podman logs $cid
159159
# Sigh. We can't check line-by-line, because 'nc' output order is
@@ -296,7 +296,7 @@ load helpers.network
296296

297297
# emit random string, and check it
298298
teststring=$(random_string 30)
299-
echo "$teststring" | nc 127.0.0.1 $myport
299+
echo "$teststring" > /dev/tcp/127.0.0.1/$myport
300300

301301
run_podman logs $cid
302302
# Sigh. We can't check line-by-line, because 'nc' output order is

test/system/helpers.network.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ function wait_for_port() {
423423
function tcp_port_probe() {
424424
local address="${2:-0.0.0.0}"
425425

426-
: | nc "${address}" "${1}"
426+
(exec echo -n >/dev/tcp/"$address/$1") >/dev/null 2>&1
427427
}
428428

429429
### Pasta Helpers ##############################################################

0 commit comments

Comments
 (0)