Skip to content

Commit

Permalink
Merge pull request #23386 from Luap99/test-fixes
Browse files Browse the repository at this point in the history
test/system: two networking test fixes
  • Loading branch information
openshift-merge-bot[bot] authored Jul 24, 2024
2 parents c804f10 + 2e20681 commit 714f7ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion test/system/250-systemd.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions test/system/505-networking-pasta.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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"
Expand Down

0 comments on commit 714f7ba

Please sign in to comment.