]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-75-RESOLVED: add test case for reloading DNSStubListenerExtra= 37856/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 16 Jun 2025 10:13:51 +0000 (19:13 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 16 Jun 2025 13:04:52 +0000 (22:04 +0900)
test/units/TEST-75-RESOLVED.sh

index 6570febe7965a0793d29460ae9d9a0bffd59bdd9..823e404e283d846c59fd08981e1cbfee8a7f5885 100755 (executable)
@@ -1003,16 +1003,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