test/system: Clarify "Local forwarder" pasta tests

This name for the tests is misleading, since in the default configuration
podman will already configure a forwarding addres, which could forward
to either another local forwarder or an external nameserver on the host
side.  What this test is really about is explicitly configuring the pasta
DNS forwarding address.  Rename accordingly.

The IPv4 version of the test doesn't use the podman --dns option, only
the pasta --dns-forward option.  This exercises the podman behaviour that
pasta --dns-forward options are added to /etc/resolv.conf automatically.
However there could also be other things in /etc/resolv.conf, so the
nslookup might not use the custom forwarding address for the lookup.

To fix that, split the test into two parts: one verifying that the custom
address is in /etc/resolv.conf and another performing the nslookup with an
explicit server address to make sure we exercise the pasta side as well.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson
2024-07-19 10:46:19 +10:00
parent 63e286ac55
commit 4919440428

View File

@@ -446,20 +446,31 @@ function pasta_test_do() {
assert "${lines[0]}" == "nameserver 169.254.1.1" "default dns forward server"
}
@test "Local forwarder, IPv4" {
@test "Custom DNS forward address, IPv4" {
skip_if_no_ipv4 "IPv4 not routable on the host"
run_podman run --rm --net=pasta:--dns-forward,198.51.100.1 \
$IMAGE nslookup l.root-servers.net
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 "Local forwarder, IPv6" {
@test "Custom DNS forward address, IPv6" {
skip_if_no_ipv6 "IPv6 not routable on the host"
# TODO: Two issues here:
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
#
# 1. With this, Podman writes "nameserver 2001:db8::1" to
# /etc/resolv.conf, without zone, and the query originates from ::1.