]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-75-RESOLVED: add test case for reloading DNSStubListenerExtra=
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 16 Jun 2025 10:13:51 +0000 (19:13 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 25 Jun 2025 17:17:42 +0000 (18:17 +0100)
(cherry picked from commit 888e3f435770568643fc97aa20b112ded94f33eb)
(cherry picked from commit 7dd11425653c93560378f293b2860198085e1d74)

test/units/TEST-75-RESOLVED.sh

index e8832f190a3981a884ba629a114164749b3b3447..ebca737747b21d347930ddbb927e304c89b466bc 100755 (executable)
@@ -958,16 +958,39 @@ testcase_12_resolvectl2() {
     {
         echo "[Resolve]"
         echo "DNS=8.8.8.8"
+        echo "DNSStubListenerExtra=127.0.0.153"
     } >/run/systemd/resolved.conf.d/reload.conf
     resolvectl dns dns0 1.1.1.1
     systemctl reload systemd-resolved.service
     resolvectl status
-    resolvectl dns dns0 | grep -qF "1.1.1.1"
-    # For some reason piping this last command to grep fails with:
-    # 'resolvectl[1378]: Failed to print table: Broken pipe'
-    # so use an intermediate file in /tmp/
-    resolvectl >/tmp/output
-    grep -qF "DNS Servers: 8.8.8.8" /tmp/output
+
+    run resolvectl dns dns0
+    grep -qF "1.1.1.1" "$RUN_OUT"
+
+    run resolvectl dns
+    grep -qF "8.8.8.8" "$RUN_OUT"
+
+    run ss -4nl
+    grep -qF '127.0.0.153' "$RUN_OUT"
+
+    {
+        echo "[Resolve]"
+        echo "DNS=8.8.4.4"
+        echo "DNSStubListenerExtra=127.0.0.154"
+    } >/run/systemd/resolved.conf.d/reload.conf
+    systemctl reload systemd-resolved.service
+    resolvectl status
+
+    run resolvectl dns dns0
+    grep -qF "1.1.1.1" "$RUN_OUT"
+
+    run resolvectl dns
+    (! grep -qF "8.8.8.8" "$RUN_OUT")
+    grep -qF "8.8.4.4" "$RUN_OUT"
+
+    run ss -4nl
+    (! grep -qF '127.0.0.153' "$RUN_OUT")
+    grep -qF '127.0.0.154' "$RUN_OUT"
 
     # Check if resolved exits cleanly.
     restart_resolved