mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
test: add simple integration test for delegation feature
This commit is contained in:
@@ -5,6 +5,7 @@ server:
|
||||
user: knot:knot
|
||||
listen: 10.0.0.1@53
|
||||
listen: fd00:dead:beef:cafe::1@53
|
||||
listen: 192.168.77.78@53
|
||||
|
||||
log:
|
||||
- target: syslog
|
||||
|
||||
@@ -22,3 +22,5 @@ unsigned NS ns1.unsigned
|
||||
|
||||
svcb SVCB 1 . alpn=dot ipv4hint=10.0.0.1 ipv6hint=fd00:dead:beef:cafe::1
|
||||
https HTTPS 1 . alpn="h2,h3"
|
||||
|
||||
delegation.excercise A 1.2.3.4
|
||||
|
||||
@@ -1302,6 +1302,47 @@ testcase_15_wait_online_dns() {
|
||||
journalctl -b -u "$unit" --grep="dns0: link is configured by networkd and online." > /dev/null
|
||||
}
|
||||
|
||||
testcase_delegate() {
|
||||
# Before we install the delegation file the DNS name should be directly resolveable via our DNS server
|
||||
run resolvectl query delegation.excercise.test
|
||||
grep -qF "1.2.3.4" "$RUN_OUT"
|
||||
|
||||
mkdir -p /run/systemd/dns-delegate.d/
|
||||
cat >/run/systemd/dns-delegate.d/testcase.dns-delegate <<EOF
|
||||
[Delegate]
|
||||
DNS=192.168.77.78
|
||||
Domains=excercise.test
|
||||
EOF
|
||||
systemctl reload systemd-resolved
|
||||
resolvectl status
|
||||
|
||||
# Now that we installed the delegation the resolution should fail, because nothing is listening on that IP address
|
||||
(! resolvectl query delegation.excercise.test)
|
||||
|
||||
# Now make that IP address connectible
|
||||
ip link add delegate0 type dummy
|
||||
ip addr add 192.168.77.78 dev delegate0
|
||||
|
||||
# This should work now
|
||||
run resolvectl query delegation.excercise.test
|
||||
grep -qF "1.2.3.4" "$RUN_OUT"
|
||||
|
||||
ip link del delegate0
|
||||
|
||||
# Let's restart here, as a way to ensure the rtnetlink delete is definitely processed.
|
||||
systemctl restart systemd-resolved
|
||||
|
||||
# Should no longer work
|
||||
(! resolvectl query delegation.excercise.test)
|
||||
|
||||
rm /run/systemd/dns-delegate.d/testcase.dns-delegate
|
||||
systemctl reload systemd-resolved
|
||||
|
||||
# Should work again without delegation in the mix
|
||||
run resolvectl query delegation.excercise.test
|
||||
grep -qF "1.2.3.4" "$RUN_OUT"
|
||||
}
|
||||
|
||||
# PRE-SETUP
|
||||
systemctl unmask systemd-resolved.service
|
||||
systemctl enable --now systemd-resolved.service
|
||||
|
||||
Reference in New Issue
Block a user