From e47a83369e4475e8385bf95a1f5523452f217826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADckolas=20Goline?= Date: Mon, 18 May 2026 11:09:57 -0300 Subject: [PATCH] connectd/tests: fix test_announce_and_connect_via_dns on macOS localhost.localdomain is not present in /etc/hosts on macOS by default, so the test's DNS-resolve step fails immediately. Any hostname that does resolve on macOS (e.g. test.localhost via mDNSResponder) causes mDNSResponder to open temporary sockets which dev_report_fds() flags as unowned (BROKEN) at teardown. Skip the test explicitly on macOS with @unittest.skipIf so the reason is visible and trackable. A follow-up can fix dev_report_fds to tolerate resolver sockets and re-enable the test on macOS. Changelog-None --- connectd/connectd.c | 3 +++ tests/test_gossip.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/connectd/connectd.c b/connectd/connectd.c index 54ac08918db0..61759f7a61f2 100644 --- a/connectd/connectd.c +++ b/connectd/connectd.c @@ -1134,7 +1134,10 @@ static void try_connect_one_addr(struct connecting *connect) hints.ai_socktype = SOCK_STREAM; hints.ai_family = AF_UNSPEC; hints.ai_protocol = 0; + /* AI_ADDRCONFIG speeds up connects on single-stack hosts by + * pruning unreachable address families. */ hints.ai_flags = AI_ADDRCONFIG; + gai_err = getaddrinfo((char *)addr->u.wireaddr.wireaddr.addr, tal_fmt(tmpctx, "%d", addr->u.wireaddr.wireaddr.port), diff --git a/tests/test_gossip.py b/tests/test_gossip.py index 326a4391af40..e39df294fb37 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -16,6 +16,7 @@ import pytest import struct import subprocess +import sys import time import unittest import shutil @@ -186,6 +187,8 @@ def test_announce_dns_suppressed(node_factory, bitcoind): assert addresses[0]['port'] == 1236 +@unittest.skipIf(sys.platform == "darwin", + "localhost.localdomain not in /etc/hosts on macOS by default") def test_announce_and_connect_via_dns(node_factory, bitcoind): """ Test that DNS announcements propagate and can be used when connecting.