]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: use 'ahost' instead of 'hosts' where applicable
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 5 Mar 2024 17:19:17 +0000 (18:19 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 6 Mar 2024 01:15:30 +0000 (01:15 +0000)
As explained in [0] the 'hosts' database uses deprecated
gethostbyname2() which uses AF_INET6 instead of AF_UNSPEC for IPv6
lookups which is broken and makes the test fail with disabled IPv6.

[0] https://github.com/systemd/systemd/pull/28136#issuecomment-1974901039

test/units/testsuite-75.sh

index b92ebf6b3319e283a154a6b12e3d4a38a2398f0d..6ff287df32f81d0a928f68ed9d04a41472b8b33e 100755 (executable)
@@ -305,16 +305,16 @@ knotc reload
 TIMESTAMP=$(date '+%F %T')
 # Issue: https://github.com/systemd/systemd/issues/23951
 # With IPv6 enabled
-run getent -s resolve hosts ns1.unsigned.test
-grep -qE "^fd00:dead:beef:cafe::1\s+ns1\.unsigned\.test" "$RUN_OUT"
+run getent -s resolve ahosts ns1.unsigned.test
+grep -qE "^fd00:dead:beef:cafe::1\s+STREAM\s+ns1\.unsigned\.test" "$RUN_OUT"
 monitor_check_rr "$TIMESTAMP" "ns1.unsigned.test IN AAAA fd00:dead:beef:cafe::1"
 # With IPv6 disabled
 # Issue: https://github.com/systemd/systemd/issues/23951
-# FIXME
-#disable_ipv6
-#run getent -s resolve hosts ns1.unsigned.test
-#grep -qE "^10\.0\.0\.1\s+ns1\.unsigned\.test" "$RUN_OUT"
-#monitor_check_rr "$TIMESTAMP" "ns1.unsigned.test IN A 10.0.0.1"
+disable_ipv6
+run getent -s resolve ahosts ns1.unsigned.test
+grep -qE "^10\.0\.0\.1\s+STREAM\s+ns1\.unsigned\.test" "$RUN_OUT"
+(! grep -qE "fd00:dead:beef:cafe::1" "$RUN_OUT")
+monitor_check_rr "$TIMESTAMP" "ns1.unsigned.test IN A 10.0.0.1"
 enable_ipv6
 
 # Issue: https://github.com/systemd/systemd/issues/18812
@@ -322,16 +322,17 @@ enable_ipv6
 # Follow-up issue: https://github.com/systemd/systemd/issues/23152
 # Follow-up PR: https://github.com/systemd/systemd/pull/23161
 # With IPv6 enabled
-run getent -s resolve hosts localhost
-grep -qE "^::1\s+localhost" "$RUN_OUT"
-run getent -s myhostname hosts localhost
-grep -qE "^::1\s+localhost" "$RUN_OUT"
+run getent -s resolve ahosts localhost
+grep -qE "^::1\s+STREAM\s+localhost" "$RUN_OUT"
+run getent -s myhostname ahosts localhost
+grep -qE "^::1\s+STREAM\s+localhost" "$RUN_OUT"
 # With IPv6 disabled
 disable_ipv6
-run getent -s resolve hosts localhost
-grep -qE "^127\.0\.0\.1\s+localhost" "$RUN_OUT"
-run getent -s myhostname hosts localhost
-grep -qE "^127\.0\.0\.1\s+localhost" "$RUN_OUT"
+run getent -s resolve ahosts localhost
+grep -qE "^127\.0\.0\.1\s+STREAM\s+localhost" "$RUN_OUT"
+(! grep -qE "::1" "$RUN_OUT")
+run getent -s myhostname ahosts localhost
+grep -qE "^127\.0\.0\.1\s+STREAM\s+localhost" "$RUN_OUT"
 enable_ipv6
 
 # Issue: https://github.com/systemd/systemd/issues/25088