Fix pasta_opts compose test to verify MTU option

Use podman exec to check ip link MTU instead of ncat-based host
connectivity test which does not actually validate pasta options.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
This commit is contained in:
Lokesh Mandvekar 2026-04-07 13:21:11 -04:00
parent 9ff3f4cb1e
commit 3c79df31a4
No known key found for this signature in database
GPG key ID: 1C1EDD7CC7C3A0DD
4 changed files with 5 additions and 30 deletions

View file

@ -1,5 +1,5 @@
services:
alpine:
image: alpine
network_mode: "pasta:--ipv4-only,-a,10.0.2.0,-n,24,-g,10.0.2.2,--dns-forward,10.0.2.3,--mtu,1280,--no-ndp,--no-dhcpv6,--no-dhcp"
command: sh -c "echo teststring | nc 10.0.2.2 5001"
network_mode: "pasta:--ipv4-only,--mtu,1280"
command: ["top"]

View file

@ -1,8 +0,0 @@
# -*- bash -*-
# create tempfile to store nc output
OUTFILE=$(mktemp)
# listen on a port, the container will try to connect to it
ncat -l 5001 > $OUTFILE &
nc_pid=$!

View file

@ -1,4 +0,0 @@
# -*- bash -*-
kill $nc_pid &> /dev/null || true
rm -f $OUTFILE

View file

@ -1,19 +1,6 @@
# -*- bash -*-
expected="teststring"
ctr_name="pasta_opts-alpine-1"
# Reading from the nc socket is flaky because docker-compose only starts
# the containers. We cannot know at this point if the container did already
# send the message. Give the container 5 seconds time to send the message
# to prevent flakes.
container_timeout=5
while [ $container_timeout -gt 0 ]; do
output="$(< $OUTFILE)"
if [ -n "$output" ]; then
break
fi
sleep 1
container_timeout=$(($container_timeout - 1))
done
is "$output" "$expected" "$testname : nc received teststring"
podman exec "$ctr_name" ip link
like "$output" "mtu 1280" "$testname : mtu is set to 1280"