naccyde / rpms / systemd

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