dcavalca / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
ac3a84
From 87d5bd17be4893556652225ae44889ff7093a0aa Mon Sep 17 00:00:00 2001
ac3a84
From: Frantisek Sumsal <frantisek@sumsal.cz>
ac3a84
Date: Fri, 8 Jul 2022 18:12:47 +0200
ac3a84
Subject: [PATCH] test: add a couple of SRV records to check service resolution
ac3a84
ac3a84
(cherry picked from commit 3095bd2ccaf55f7c20567b990844dc2d9b451376)
ac3a84
ac3a84
Related: #2138081
ac3a84
---
ac3a84
 test/knot-data/zones/signed.test.zone    |  8 ++++++++
ac3a84
 test/knot-data/zones/untrusted.test.zone |  4 ++++
ac3a84
 test/units/testsuite-75.sh               | 17 +++++++++++++++++
ac3a84
 3 files changed, 29 insertions(+)
ac3a84
ac3a84
diff --git a/test/knot-data/zones/signed.test.zone b/test/knot-data/zones/signed.test.zone
ac3a84
index fa6706205a..6ddeb0048e 100644
ac3a84
--- a/test/knot-data/zones/signed.test.zone
ac3a84
+++ b/test/knot-data/zones/signed.test.zone
ac3a84
@@ -49,3 +49,11 @@ follow11.yet.so.far   CNAME follow12.getting.hot.signed.test.
ac3a84
 follow12.getting.hot  CNAME follow13.almost.final.signed.test.
ac3a84
 follow13.almost.final CNAME follow14.final.signed.test.
ac3a84
 follow14.final        A     10.0.0.14
ac3a84
+
ac3a84
+myservice             A     10.0.0.20
ac3a84
+myservice             AAAA  fd00:dead:beef:cafe::17
ac3a84
+_mysvc._tcp           SRV   10 5 1234 myservice
ac3a84
+
ac3a84
+_invalidsvc._udp      SRV   5 5 1111 invalidservice
ac3a84
+
ac3a84
+_untrustedsvc._udp    SRV   5 5 1111 myservice.untrusted.test.
ac3a84
diff --git a/test/knot-data/zones/untrusted.test.zone b/test/knot-data/zones/untrusted.test.zone
ac3a84
index cf0dec5296..a0dca62ca8 100644
ac3a84
--- a/test/knot-data/zones/untrusted.test.zone
ac3a84
+++ b/test/knot-data/zones/untrusted.test.zone
ac3a84
@@ -20,3 +20,7 @@ $ORIGIN untrusted.test.
ac3a84
                       A    10.0.0.121
ac3a84
                       AAAA fd00:dead:beef:cafe::121
ac3a84
 mail                  A    10.0.0.122
ac3a84
+
ac3a84
+myservice             A    10.0.0.123
ac3a84
+                      AAAA fd00:dead:beef:cafe::123
ac3a84
+_mysvc._tcp           SRV  10 5 1234 myservice
ac3a84
diff --git a/test/units/testsuite-75.sh b/test/units/testsuite-75.sh
ac3a84
index 76b8f5b3c7..66cc6c9d66 100755
ac3a84
--- a/test/units/testsuite-75.sh
ac3a84
+++ b/test/units/testsuite-75.sh
ac3a84
@@ -367,6 +367,19 @@ grep -qF "status: NXDOMAIN" "$RUN_OUT"
ac3a84
 run resolvectl query -t TXT this.should.be.authenticated.wild.signed.test
ac3a84
 grep -qF 'this.should.be.authenticated.wild.signed.test IN TXT "this is a wildcard"' "$RUN_OUT"
ac3a84
 grep -qF "authenticated: yes" "$RUN_OUT"
ac3a84
+# Check SRV support
ac3a84
+run resolvectl service _mysvc._tcp signed.test
ac3a84
+grep -qF "myservice.signed.test:1234" "$RUN_OUT"
ac3a84
+grep -qF "10.0.0.20" "$RUN_OUT"
ac3a84
+grep -qF "fd00:dead:beef:cafe::17" "$RUN_OUT"
ac3a84
+grep -qF "authenticated: yes" "$RUN_OUT"
ac3a84
+(! run resolvectl service _invalidsvc._udp signed.test)
ac3a84
+grep -qE "invalidservice\.signed\.test' not found" "$RUN_OUT"
ac3a84
+run resolvectl service _untrustedsvc._udp signed.test
ac3a84
+grep -qF "myservice.untrusted.test:1111" "$RUN_OUT"
ac3a84
+grep -qF "10.0.0.123" "$RUN_OUT"
ac3a84
+grep -qF "fd00:dead:beef:cafe::123" "$RUN_OUT"
ac3a84
+grep -qF "authenticated: yes" "$RUN_OUT"
ac3a84
 
ac3a84
 # DNSSEC validation with multiple records of the same type for the same name
ac3a84
 # Issue: https://github.com/systemd/systemd/issues/22002
ac3a84
@@ -479,6 +492,10 @@ grep -qF "untrusted.test:" "$RUN_OUT"
ac3a84
 grep -qF "10.0.0.121" "$RUN_OUT"
ac3a84
 grep -qF "fd00:dead:beef:cafe::121" "$RUN_OUT"
ac3a84
 grep -qF "authenticated: no" "$RUN_OUT"
ac3a84
+run resolvectl service _mysvc._tcp untrusted.test
ac3a84
+grep -qF "myservice.untrusted.test:1234" "$RUN_OUT"
ac3a84
+grep -qF "10.0.0.123" "$RUN_OUT"
ac3a84
+grep -qF "fd00:dead:beef:cafe::123" "$RUN_OUT"
ac3a84
 
ac3a84
 # Issue: https://github.com/systemd/systemd/issues/19472
ac3a84
 # 1) Query for a non-existing RR should return NOERROR + NSEC (?), not NXDOMAIN