Skip to content

Pin localhost to 127.0.0.1 in the test clients - #223

Merged
huacnlee merged 1 commit into
mainfrom
ci/faster-macos-tests
Sep 15, 2026
Merged

huacnlee merged 1 commit into
mainfrom
ci/faster-macos-tests

Conversation

@huacnlee

Copy link
Copy Markdown
Owner

The macOS CI job spent 615 seconds in the lib test suite that takes 35 seconds locally. The job log shows the time in backend::mail::action_tests and the other synthetic-peer tests, in gaps of 12, 24, 36… seconds: one 10-second connect_timeout per new connection.

The peers listen on 127.0.0.1 with a certificate for localhost, and the tests connect by name. On the runner the IPv6 loopback address is answered first and the connection attempt on it is left to time out before IPv4 is tried.

A #[cfg(test)] helper pins localhost to 127.0.0.1 on every test client (resolve(), so the certificate is still verified against the name), applied in the JMAP and Gmail client_builder()s and the two ad-hoc report clients. No production code path changes.

Expected effect: the macOS standalone app job drops from ~19 minutes to under ten. Together with #222 (dependency caching) the remaining time is the release build and Qt.

🤖 Generated with Claude Code

The synthetic peers listen on 127.0.0.1 and hold a certificate for
localhost, so the tests connect by that name. On the macOS CI host the
IPv6 loopback answer came first and the attempt on it was left to time
out before IPv4 was tried: ten seconds a connection, and the lib suite
took ten minutes there against thirty-five seconds locally. The test
clients now resolve the name to the address the peer has; the
certificate is still checked against the name.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@huacnlee
huacnlee merged commit 82b14d7 into main Sep 15, 2026
14 checks passed
@huacnlee
huacnlee deleted the ci/faster-macos-tests branch September 15, 2026 10:58
huacnlee added a commit that referenced this pull request Sep 15, 2026
That was not where the time went: the macOS job still took 21 minutes
with the pin in place. The synthetic peers' bind-time reverse lookup
was, and the previous commit removes it.

This reverts commit 82b14d7.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
huacnlee added a commit that referenced this pull request Sep 15, 2026
The macOS CI job spends ~615 seconds in the lib test suite that takes 35
seconds locally, all of it in tests that start a Python
`http.server.HTTPServer` as their synthetic JMAP peer
(`backend::mail::action_tests`, the discovery tests).

`HTTPServer.server_bind` calls `socket.getfqdn(host)` on the bound
address: a reverse DNS lookup of `127.0.0.1` that the runner's resolver
leaves to time out, about ten seconds per server start. A test with five
scenarios starts five peers and pays it five times — the "has been
running for over 60 seconds" lines in the log.

The two peers now bind through a subclass that skips the lookup. #223
pinned `localhost` in the Rust test clients on the theory that the IPv6
loopback attempt was timing out; its job still took 21 minutes, so that
change is reverted here rather than left in with a wrong explanation
attached.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant