Skip to content

Share test port allocations across suites - #2838

Merged
deetergp merged 10 commits into
mainfrom
tyler-parallel-test-port-allocation
Oct 8, 2026
Merged

deetergp merged 10 commits into
mainfrom
tyler-parallel-test-port-allocation

Conversation

@tylerkaraszewski

@tylerkaraszewski tylerkaraszewski commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Hold for https://github.com/Expensify/Auth/pull/25217

Hold for https://github.com/Expensify/FuzzyBot/pull/372

Hold for https://github.com/Expensify/ExpensifyBackupManager/pull/189

Merge these backward-compatible preparation changes first, then this PR.

Details

PortMap only tracks allocations within one process, so separate test suites (i.e., running in different worktrees) can select the same port before either Bedrock instance binds it. This adds a small port server shared by all test suites and worktrees running under the same Unix user.

Each client registers its PID and owns its port reservations. Multiple clients can share a PID, and ports are released when they're returned, when the client disconnects, or when its PID exits. The server starts lazily, holds a singleton lock throughout its lifetime, and exits when its last client disappears. PID monitoring uses Linux pidfds or macOS kqueue, so inherited sockets and unreaped processes don't prevent cleanup.

The existing getPort(), returnPort(), and waitForPort() calls stay in place. Most of the implementation is in new files; PortMap.cpp remains a forwarding file for consumers such as Auth that explicitly list it in their builds. The helper is built alongside Bedrock and the test binaries.

This change is basically 100% AI written, and only affects how the test suite operates. I wouldn't worry a ton about reviewing every detail for perfection, so long as it generally seems to function OK. We can always improve it later.

Fixed Issues

For https://github.com/Expensify/Expensify/issues/689406

Tests

There are new tests added for this. Also, all PRs above have been tested using the new PortServer


Internal Testing Reminder: when changing bedrock, please compile auth against your new changes

@tylerkaraszewski tylerkaraszewski self-assigned this Oct 6, 2026
@tylerkaraszewski tylerkaraszewski changed the title Share test port allocations across suites [HOLD] Share test port allocations across suites Oct 6, 2026
@tylerkaraszewski
tylerkaraszewski marked this pull request as ready for review October 7, 2026 18:53
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T18:57:14.524004Z c02fad1 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@tylerkaraszewski tylerkaraszewski changed the title [HOLD] Share test port allocations across suites Share test port allocations across suites Oct 7, 2026
@deetergp
deetergp merged commit 4b3a9f2 into main Oct 8, 2026
9 of 10 checks passed
@deetergp
deetergp deleted the tyler-parallel-test-port-allocation branch October 8, 2026 17:41
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.

2 participants