Skip to content

Commit

Permalink
fix aarch64 ncat flake
Browse files Browse the repository at this point in the history
I am not not 100% sure because I was unable to reproduce even with
hack/get_ci_vm.sh. This flakes permanently in CI so there must be a
different in the environment which causes it.

However looking at the code we spawn the nc listener in the background
so there is no guarantee that it will already listen when we make the nc
connect call. To fix this we use the wait_for_port logic to ensure the
port is bound.
For now there is no sctp support, the /proc file format for it is
completely different and I didn't want to spend more time on it so I
just added a sleep and call it good enough.

Fixes containers#433

Signed-off-by: Paul Holzinger <[email protected]>
  • Loading branch information
Luap99 authored and flouthoc committed Apr 24, 2023
1 parent 882b185 commit 85411f9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,16 @@ function run_nc_test() {
nsenter -n -t "${CONTAINER_NS_PIDS[$container_ns]}" timeout --foreground -v --kill=10 5 \
nc $nc_common_args -l -p $container_port &>"$NETAVARK_TMPDIR/nc-out" <$stdin &

# make sure to wait until port is bound otherwise test can flake
# https://github.com/containers/netavark/issues/433
if [ "$proto" = "tcp" ] || [ "$proto" = "udp" ]; then
wait_for_port "${CONTAINER_NS_PIDS[$container_ns]}" $container_port $proto
else
# TODO add support for sctp port reading from /proc/net/sctp/eps,
# for now just sleep
sleep 0.5
fi

data=$(random_string)
run_in_host_netns nc $nc_common_args $connect_ip $host_port <<<"$data"

Expand Down

0 comments on commit 85411f9

Please sign in to comment.