Skip to content

connectd/tests: fix test_announce_and_connect_via_dns on macOS#9143

Merged
nGoline merged 1 commit into
ElementsProject:masterfrom
nGoline:dns-announce-macos-fix
Jul 3, 2026
Merged

connectd/tests: fix test_announce_and_connect_via_dns on macOS#9143
nGoline merged 1 commit into
ElementsProject:masterfrom
nGoline:dns-announce-macos-fix

Conversation

@nGoline

@nGoline nGoline commented May 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Skip test_announce_and_connect_via_dns with a clear message when localhost.localdomain is not resolvable (macOS omits it from /etc/hosts by default)
  • Guard AI_ADDRCONFIG in try_connect_one_addr() with #ifndef __APPLE__: on macOS/BSD, AI_ADDRCONFIG opens temporary probe sockets that are not tracked by the io framework, causing dev_report_fds() to report them as unowned (**BROKEN**); Linux keeps the optimization unchanged

Closes #9012

Test plan

  • uv run pytest tests/test_gossip.py::test_announce_and_connect_via_dns -v passes on Linux
  • On macOS without localhost.localdomain in /etc/hosts: test is skipped with a descriptive message
  • On macOS with localhost.localdomain in /etc/hosts: no **BROKEN** fd messages from connectd at teardown

🤖 Generated with Claude Code

@nGoline nGoline requested a review from ddustin May 18, 2026 14:16
@nGoline nGoline force-pushed the dns-announce-macos-fix branch 2 times, most recently from 89d3d46 to b7b271c Compare May 18, 2026 20:50
@nGoline nGoline added this to the v26.09 milestone May 21, 2026
@madelinevibes madelinevibes added the Status::Ready for Review The work has been completed and is now awaiting evaluation or approval. label Jun 18, 2026
Comment thread tests/test_gossip.py Outdated
@nGoline nGoline force-pushed the dns-announce-macos-fix branch from b7b271c to e47a833 Compare June 19, 2026 14:47
@nGoline nGoline requested a review from ddustin June 19, 2026 14:47
@ddustin ddustin force-pushed the dns-announce-macos-fix branch from e47a833 to 4108150 Compare June 26, 2026 14:01
@ddustin

ddustin commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Rebasing for CI

@nGoline nGoline force-pushed the dns-announce-macos-fix branch from 4108150 to 3bef57a Compare July 1, 2026 14:40
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
@nGoline nGoline force-pushed the dns-announce-macos-fix branch from 3bef57a to 40f2ce6 Compare July 3, 2026 12:35
@nGoline nGoline merged commit 40f2ce6 into ElementsProject:master Jul 3, 2026
81 of 87 checks passed
@nGoline nGoline added Status::Release Ready ✅🤩 and removed Status::Ready for Review The work has been completed and is now awaiting evaluation or approval. labels Jul 3, 2026
@nGoline nGoline deleted the dns-announce-macos-fix branch July 3, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pytest: **BROKEN** Error in test test_announce_and_connect_via_dns

3 participants