Merge pull request #23386 from Luap99/test-fixes

test/system: two networking test fixes
This commit is contained in:
openshift-merge-bot[bot] 2024-07-24 14:38:22 +00:00 • committed by GitHub
commit 714f7bacb2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 3 deletions

View file

@ -319,7 +319,8 @@ LISTEN_FDNAMES=listen_fdnames" | sort)
# stop systemd container
service_cleanup
pasta_iface=$(default_ifname)
pasta_iface=$(default_ifname 4)
assert "$pasta_iface" != "" "pasta_iface is set"
# now check that the rootless netns slirp4netns process is still alive and working
run_podman unshare --rootless-netns ip addr

View file

@ -784,7 +784,8 @@ EOF
@test "Podman unshare --rootless-netns with Pasta" {
skip_if_remote "unshare is local-only"
pasta_iface=$(default_ifname)
pasta_iface=$(default_ifname 4)
assert "$pasta_iface" != "" "pasta_iface is set"
# First let's force a setup error by making pasta be "false".
ln -s /usr/bin/false $PODMAN_TMPDIR/pasta
@ -802,7 +803,10 @@ EOF
pasta_ip="$(default_addr 4)"
host_ips=$(ip -4 -j addr | jq -r '.[] | select(.ifname != "lo") | .addr_info[].local')
for network in "pasta" "bridge"; do
netname=n_$(safename)
run_podman network create $netname
for network in "pasta" "$netname"; do
# special exit code logic needed here, it is possible that there is no host.containers.internal
# when there is only one ip one the host and that one is used by pasta.
# As such we have to deal with both cases.
@ -819,6 +823,8 @@ EOF
fi
done
run_podman network rm $netname
first_host_ip=$(head -n 1 <<<"$host_ips")
run_podman run --rm --network=pasta:-a,169.254.0.2,-g,169.254.0.1,-n,24 $IMAGE grep host.containers.internal /etc/hosts
assert "$output" =~ "^$first_host_ip" "uses host first ip"