Skip to content

test: move NewTestContext into test/framework/context#31

Open
chethanuk wants to merge 1 commit into
feat/1188-net-movefrom
feat/1188-context-move
Open

test: move NewTestContext into test/framework/context#31
chethanuk wants to merge 1 commit into
feat/1188-net-movefrom
feat/1188-context-move

Conversation

@chethanuk

Copy link
Copy Markdown
Owner

What type of PR is this?

/kind cleanup
/kind test

What this PR does / why we need it:

Third of eight in the llm-d#1188 split. It follows the test/framework/net move.

NewTestContext builds a context.Context carrying a testing.T-bound logger, and
it was the last piece of test/utils that every plugin test depends on. The body is
unchanged. Twenty test files under pkg/epp/framework/plugins/ swap to the
fwkcontext alias, and test/utils/context.go is deleted.

Two deviations from a pure move. The new file carries the llm-d Apache header, which
the old file had none of. And package utils's package comment moves to
test/utils/handle.go. That one is forced: the previous PR removed network.go, so
context.go held the last copy, and dropping it makes revive's package-comments
rule fire.

Anyone adding a caller later must import this package as fwkcontext. A bare import
binds the name context and shadows the stdlib package, and importas has
no-unaliased: false, so it will not catch that.

Test plan:

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

Which issue(s) this PR fixes:

Part of llm-d#1188

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

NONE

NewTestContext is the last piece of test/utils that every plugin test depends
on, so it belongs in the shared test/framework tree the issue defines rather
than in a package named for what it is not. The function body is unchanged;
the only edits are the package clause, a license header the old file lacked,
and a package comment on the new file. The twenty callers switch to the
fwkcontext alias. test/utils keeps its package comment, which moves to
handle.go with the file that carried it deleted.

Part of llm-d#1188

Signed-off-by: ChethanUK <chethanuk@outlook.com>
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8ba417a2-b8a1-4d44-872c-e2e806a8578b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/1188-context-move

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the test context utility by moving NewTestContext from test/utils to a new package under test/framework/context, updating all importing test files to use the new path. The review feedback suggests renaming the new package from context to fwkcontext to avoid shadowing the Go standard library's context package.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +17 to +18
// Package context provides context helpers for tests.
package context

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Naming the package context can easily lead to shadowing of the Go standard library's context package if imported without an alias.

By declaring the package as fwkcontext instead of context, the default package identifier when imported becomes fwkcontext. This completely eliminates the risk of shadowing the standard library context package, and also makes the explicit fwkcontext import alias optional in all importing files.

Suggested change
// Package context provides context helpers for tests.
package context
// Package fwkcontext provides context helpers for tests.
package fwkcontext

limitations under the License.
*/

package context

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Update the package name to fwkcontext to match the package declaration in context.go.

Suggested change
package context
package fwkcontext

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.

1 participant