Skip to content

Commit

Permalink
test: use 'ahost' instead of 'hosts' where applicable
Browse files Browse the repository at this point in the history
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] systemd/systemd#28136 (comment)
  • Loading branch information
mrc0mmand authored and bluca committed Mar 6, 2024
1 parent a850ae7 commit 4e5a7e1
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions test/units/testsuite-75.sh
Original file line number Diff line number Diff line change
Expand Up @@ -305,33 +305,34 @@ 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
# PR: https://github.com/systemd/systemd/pull/18896
# 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
Expand Down

0 comments on commit 4e5a7e1

Please sign in to comment.