mirror of
https://github.com/containers/podman.git
synced 2025-10-16 10:43:52 +08:00
Merge pull request #26221 from Luap99/resolv
libpod: don't force only network search domains
This commit is contained in:
@ -1152,24 +1152,27 @@ EXPOSE 2004-2005/tcp`, ALPINE)
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--name", "con1", "--network", net, CITEST_IMAGE, "nslookup", "con1"})
|
||||
// Note apline nslookup tries to resolve all search domains always and returns an error if one does not resolve.
|
||||
// Because we leak all host search domain into the container we have no control over if it resolves or not.
|
||||
// Thus use "NAME." to indicate the name is full and no search domain should be tried.
|
||||
session = podmanTest.Podman([]string{"run", "--name", "con1", "--network", net, CITEST_IMAGE, "nslookup", "con1."})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--name", "con2", "--pod", pod, "--network", net, CITEST_IMAGE, "nslookup", "con2"})
|
||||
session = podmanTest.Podman([]string{"run", "--name", "con2", "--pod", pod, "--network", net, CITEST_IMAGE, "nslookup", "con2."})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--name", "con3", "--pod", pod2, CITEST_IMAGE, "nslookup", "con1"})
|
||||
session = podmanTest.Podman([]string{"run", "--name", "con3", "--pod", pod2, CITEST_IMAGE, "nslookup", "con1."})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitWithError(1, ""))
|
||||
Expect(session.OutputToString()).To(ContainSubstring("server can't find con1.dns.podman: NXDOMAIN"))
|
||||
Expect(session.OutputToString()).To(ContainSubstring("NXDOMAIN"))
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--name", "con4", "--network", net, CITEST_IMAGE, "nslookup", pod2 + ".dns.podman"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--network", net, CITEST_IMAGE, "nslookup", hostname})
|
||||
session = podmanTest.Podman([]string{"run", "--network", net, CITEST_IMAGE, "nslookup", hostname + "."})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
})
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user