Skip to content

Fix flaky allocation test - #2465

Merged
lancepioch merged 1 commit into
mainfrom
tests/allocation-port-flake
Jul 18, 2026
Merged

Fix flaky allocation test#2465
lancepioch merged 1 commit into
mainfrom
tests/allocation-port-flake

Conversation

@lancepioch

Copy link
Copy Markdown
Member

The allocation factory picks a random port between 1024 and 65535, and a few tests hardcode ports 5000-5005 on the same node and ip as the server's factory allocation. When the random port happens to land in that range, the unique (node_id, ip, port) index fails the test - the SQLite job on #2464 hit exactly this. Raise the factory floor to 10000 so the two can never overlap.

FindAssignableAllocationServiceTest creates allocations on ports
5000-5005 using the same node and ip as the server's own factory
allocation. That allocation gets a random port from 1024-65535, so once
in a while it lands inside that range and the unique (node_id, ip, port)
index fails the test. Raise the factory floor to 10000 so they can never
overlap.
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e536a5f8-4ae2-48dc-ad2c-20899205c9c8

📥 Commits

Reviewing files that changed from the base of the PR and between 21d125d and 4352f2b.

📒 Files selected for processing (1)
  • database/Factories/AllocationFactory.php

📝 Walkthrough

Walkthrough

The allocation factory now generates ports from 10000 to 65535 and documents the constraint used to avoid conflicts with hardcoded test ports.

Changes

Allocation factory generation

Layer / File(s) Summary
Constrained port generation
database/Factories/AllocationFactory.php
The generated port range is narrowed to 10000–65535, with a comment explaining the boundary relative to hardcoded test ports.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: reducing flaky allocation test failures caused by random port collisions.
Description check ✅ Passed The description directly explains the port-range change and the test collision it prevents.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lancepioch
lancepioch merged commit b1dd8d9 into main Jul 18, 2026
16 checks passed
@lancepioch
lancepioch deleted the tests/allocation-port-flake branch July 18, 2026 16:39
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant