Merge pull request #23336 from dgibson/pasta-dns

Fix several reliability problems with pasta DNS handling tests
This commit is contained in:
openshift-merge-bot[bot] 2024-09-23 16:02:53 +00:00 committed by GitHub
commit 3fb9619298
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 34 additions and 25 deletions

View File

@ -434,43 +434,52 @@ function pasta_test_do() {
### DNS ########################################################################
@test "External resolver, IPv4" {
skip_if_no_ipv4 "IPv4 not routable on the host"
run_podman '?' run --rm --net=pasta $IMAGE nslookup 127.0.0.1
assert "$output" =~ "1.0.0.127.in-addr.arpa" \
"127.0.0.1 not resolved"
@test "Basic nameserver lookup" {
run_podman run --rm --net=pasta $IMAGE nslookup l.root-servers.net
}
@test "External resolver, IPv6" {
skip_if_no_ipv6 "IPv6 not routable on the host"
run_podman '?' run --rm --net=pasta $IMAGE nslookup ::1
assert "$output" =~ "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" \
"::1 not resolved"
}
@test "Local forwarder, IPv4" {
@test "Default nameserver forwarding" {
skip_if_no_ipv4 "IPv4 not routable on the host"
# pasta is the default now so no need to set it
run_podman run --rm $IMAGE grep nameserver /etc/resolv.conf
assert "${lines[0]}" == "nameserver 169.254.1.1" "default dns forward server"
run_podman run --rm --net=pasta:--dns-forward,198.51.100.1 \
$IMAGE nslookup 127.0.0.1 || :
assert "$output" =~ "1.0.0.127.in-addr.arpa" "No answer from resolver"
}
@test "Local forwarder, IPv6" {
@test "Custom DNS forward address, IPv4" {
skip_if_no_ipv4 "IPv4 not routable on the host"
local addr=198.51.100.1
run_podman run --rm --net=pasta:--dns-forward,$addr \
$IMAGE grep nameserver /etc/resolv.conf
assert "${lines[0]}" == "nameserver $addr" "custom dns forward server"
run_podman run --rm --net=pasta:--dns-forward,$addr \
$IMAGE nslookup l.root-servers.net $addr
}
@test "Custom DNS forward address, IPv6" {
skip_if_no_ipv6 "IPv6 not routable on the host"
# TODO: Two issues here:
# TODO: In fact, this requires not just IPv6 connectivity on the
# host, but an IPv6 reachable nameserver which is harder to
# test for. We could remove that requirement if pasta could
# forward between IPv4 and IPv6 addresses but as of
# 2024_09_06.6b38f07 that's unsupported. Skip the test for
# now.
skip "Currently unsupported"
# run_podman run --dns 2001:db8::1 \
# --net=pasta:--dns-forward,2001:db8::1 $IMAGE nslookup ::1
# local addr=2001:db8::1
#
# run_podman run --rm --net=pasta:--dns-forward,$addr \
# $IMAGE grep nameserver /etc/resolv.conf
# assert "${lines[0]}" == "nameserver $addr" "custom dns forward server"
# run_podman run --rm --net=pasta:--dns-forward,$addr \
# $IMAGE nslookup l.root-servers.net $addr
#
# TODO: In addition to the IPv6 nameserver requirement above,
# there seem to be two problems running this test. It's
# unclear if those are in busybox, musl or pasta.
#
# 1. With this, Podman writes "nameserver 2001:db8::1" to
# /etc/resolv.conf, without zone, and the query originates from ::1.