inspect with network=none show SandboxKey netns path

We do not use any special netns path for the netns=none case, however
callers that inspect that may still wish to join the netns path directly
without extra work to figure out /proc/$pid/ns/net.

Fixes #16716

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2023-07-31 14:07:35 +02:00
parent b6a52f1f8b
commit ada71889c7
4 changed files with 22 additions and 7 deletions

View File

@@ -834,10 +834,18 @@ EOF
run_podman create --network=$network $IMAGE
cid=${output}
run_podman inspect --format '{{ .NetworkSettings.Networks }}' $cid
is "$output" "map\[$network:.*" "NeworkSettincs should contain one network named $network"
is "$output" "map\[$network:.*" "NeworkSettings should contain one network named $network"
run_podman inspect --format '{{ .NetworkSettings.SandboxKey }}' $cid
assert "$output" == "" "SandboxKey for network=$network should be empty when not running"
run_podman rm $cid
done
run_podman run -d --network=none $IMAGE top
cid=${output}
run_podman inspect --format '{{ .NetworkSettings.SandboxKey }}' $cid
assert "$output" =~ "^/proc/[0-9]+/ns/net\$" "SandboxKey for network=none when running"
run_podman rm -f -t0 $cid
# Check with ns:/PATH
if ! is_rootless; then
netns=netns$(random_string)