test/system: check --dns-option behavior

We should fully replace the options, now that we vendored the
libnetwork/resolvconf changes into podman this just works.

Fixes: #22399

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
(cherry picked from commit 89b8e23385)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2025-06-02 18:45:19 +02:00
parent 90c9c2271e
commit 04447cc322

View File

@@ -902,11 +902,21 @@ EOF
@test "podman network rm --dns-option " {
dns_opt=dns$(random_string)
run_podman run --rm --dns-opt=${dns_opt} $IMAGE cat /etc/resolv.conf
is "$output" ".*options ${dns_opt}" "--dns-opt was added"
# Note that we must fully replace all host option so make a match for line start/end as well
# https://github.com/containers/podman/issues/22399
assert "$output" =~ ".*^options ${dns_opt}\$" "--dns-opt was added"
dns_opt=dns$(random_string)
run_podman run --rm --dns-option=${dns_opt} $IMAGE cat /etc/resolv.conf
is "$output" ".*options ${dns_opt}" "--dns-option was added"
assert "$output" =~ ".*^options ${dns_opt}\$" "--dns-option was added"
# now check with a custom network as well
local net=net-$(safename)
run_podman network create $net
run_podman run --rm --network $net --dns-option=${dns_opt} $IMAGE cat /etc/resolv.conf
assert "$output" =~ ".*^options ${dns_opt}\$" "--dns-option was added with custom network"
run_podman network rm -f $net
}
# bats test_tags=ci:parallel