Skip to content

Commit

Permalink
Merge pull request containers#23336 from dgibson/pasta-dns
Browse files Browse the repository at this point in the history
Fix several reliability problems with pasta DNS handling tests
  • Loading branch information
openshift-merge-bot[bot] authored Sep 23, 2024
2 parents ff5b82f + 2505381 commit 3fb9619
Showing 1 changed file with 33 additions and 24 deletions.
57 changes: 33 additions & 24 deletions test/system/505-networking-pasta.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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 "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 "Basic nameserver lookup" {
run_podman run --rm --net=pasta $IMAGE nslookup l.root-servers.net
}

@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"
}

@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,198.51.100.1 \
$IMAGE nslookup 127.0.0.1 || :
assert "$output" =~ "1.0.0.127.in-addr.arpa" "No answer from resolver"
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 "Local forwarder, IPv6" {
@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.
Expand Down

0 comments on commit 3fb9619

Please sign in to comment.