Skip to content

test: move GetFreePort into test/framework/net#2122

Open
chethanuk wants to merge 2 commits into
llm-d:mainfrom
chethanuk:feat/1188-net-move
Open

test: move GetFreePort into test/framework/net#2122
chethanuk wants to merge 2 commits into
llm-d:mainfrom
chethanuk:feat/1188-net-move

Conversation

@chethanuk

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind cleanup
/kind test

What this PR does / why we need it:

Second of eight in the #1188 split. It follows the Makefile wiring PR that creates
test/framework and puts it under make test-unit.

This branch is based on #2121, so the diff currently includes that PR's commit as
well. Once #2121 merges this becomes a single commit touching only the
test/framework/net files.

GetFreePort is a network helper. It sat in test/utils, which is how a package
becomes a grab bag: nothing in the name says what belongs there, so everything does.
test/framework/net is where a port helper belongs.

The move is verbatim. The function body is unchanged; the deltas are the package
clause, the llm-d license header and a package comment, none of which
test/utils/network.go carried. Callers switch to the fwknet alias that
.golangci.yml already declares.

test/framework/net imports nothing from pkg/, so it stays an R1 leaf under the
layering rules in test/framework/doc.go. The chain moves one leaf package per PR so
each is revertable on its own, with the harness last because it is the heaviest.

Test plan:

  • go build and go vet ./test/... clean at this commit
  • go test ./test/framework/... passes, including the moved test

Which issue(s) this PR fixes:

Part of #1188

Release note (write NONE if no user-facing change):

NONE

The test/framework tree that llm-d#1188 introduces has no Makefile entry, so its
packages would not run under make test-unit and would be absent from the
coverage comparison. Wire the package set in before any helper moves land, so
each follow-up move arrives with test execution and coverage already in place.

The importas aliases for the planned framework packages are added in the same
change: golangci-lint ignores entries for packages that do not exist yet, so
the later moves do not each have to touch the lint config.

Part of llm-d#1188

Signed-off-by: ChethanUK <chethanuk@outlook.com>
GetFreePort is a network helper, not a general test util. Moving it into the
test/framework tree gives it an obvious home and keeps test/utils from growing
into a grab bag. The function body is unchanged; the only edit is the package
clause plus a license header and package comment on the new file.

Part of llm-d#1188

Signed-off-by: ChethanUK <chethanuk@outlook.com>
@chethanuk
chethanuk requested review from a team, roytman and shmuelk as code owners July 21, 2026 18:35
@chethanuk
chethanuk requested review from ahg-g and elevran July 21, 2026 18:35
@github-actions github-actions Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/cleanup labels Jul 21, 2026
@roytman
roytman requested a review from Copilot July 21, 2026 20:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR continues the #1188 test-framework consolidation by relocating the GetFreePort helper into the structured test/framework/net package and updating callers to use the fwknet import alias (as enforced by golangci-lint). It also includes the test/framework unit-test wiring (from the #2121 base) so these helpers are executed under make test-unit and included in coverage output.

Changes:

  • Move GetFreePort() into test/framework/net (package/headers/comment updates only) and keep its unit test alongside it.
  • Update callers to import test/framework/net as fwknet.
  • Wire ./test/framework/... into make test-unit / make test-coverage and add golangci-lint importas aliases for planned framework packages.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/integration/epp/harness.go Switch GetFreePort calls to fwknet.GetFreePort() and update imports accordingly.
test/framework/net/net.go Define test/framework/net package and host the moved GetFreePort() implementation.
test/framework/net/net_test.go Update test package to net so it tests the relocated helper in-place.
test/framework/framework_test.go Add a minimal test to ensure test/framework reports ok when executed under unit-test targets.
test/framework/doc.go Document the intended layering/import rules for the test/framework tree.
pkg/sidecar/proxy/data_parallel_test.go Switch GetFreePort usage to fwknet.GetFreePort() in sidecar proxy tests.
Makefile Add framework_TEST_PACKAGES, run framework unit tests under test-unit, and make test-coverage depend on test-unit.
.golangci.yml Add importas aliases for test/framework/* packages (including fwknet).

Comment thread .golangci.yml
@@ -81,6 +81,16 @@ linters:
alias: errcommon
- pkg: github.com/llm-d/llm-d-router/test/utils/igw

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, but the path test/utils/igw no longer exists

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't touch it since it wasn't part of this PR. I'll probably handle that separately in another PR?

@shmuelk

shmuelk commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

@chethanuk Please rebase and resolve the conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants