Skip to content

Commit ac0ca20

Browse files
committed
test/system: check --dns-option behavior
We should fully replace the options, now that we vendored the libnetwork/resolvconf chnages into podman this just works. Fixes: #22399 Signed-off-by: Paul Holzinger <[email protected]>
1 parent 75dc508 commit ac0ca20

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

test/system/500-networking.bats

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,11 +902,21 @@ EOF
902902
@test "podman network rm --dns-option " {
903903
dns_opt=dns$(random_string)
904904
run_podman run --rm --dns-opt=${dns_opt} $IMAGE cat /etc/resolv.conf
905-
is "$output" ".*options ${dns_opt}" "--dns-opt was added"
905+
# Note that we must fully repalce all host option so make a match for line start/end as well
906+
# https://github.com/containers/podman/issues/22399
907+
assert "$output" =~ ".*^options ${dns_opt}\$" "--dns-opt was added"
906908

907909
dns_opt=dns$(random_string)
908910
run_podman run --rm --dns-option=${dns_opt} $IMAGE cat /etc/resolv.conf
909-
is "$output" ".*options ${dns_opt}" "--dns-option was added"
911+
assert "$output" =~ ".*^options ${dns_opt}\$" "--dns-option was added"
912+
913+
# now check with a custom network as well
914+
local net=net-$(safename)
915+
run_podman network create $net
916+
run_podman run --rm --network $net --dns-option=${dns_opt} $IMAGE cat /etc/resolv.conf
917+
assert "$output" =~ ".*^options ${dns_opt}\$" "--dns-option was added with custom network"
918+
919+
run_podman network rm -f $net
910920
}
911921

912922
# bats test_tags=ci:parallel

0 commit comments

Comments
 (0)