Skip to content

test: cover InferencePoolToEndpointPool - #3011

Merged
ahg-g merged 1 commit into
kubernetes-sigs:mainfrom
UgaTheDev:test/pool-conversion-coverage
Aug 10, 2026
Merged

ahg-g merged 1 commit into
kubernetes-sigs:mainfrom
UgaTheDev:test/pool-conversion-coverage

Conversation

@UgaTheDev

Copy link
Copy Markdown
Contributor

What type of PR is this?
/kind test

What this PR does / why we need it:

pkg/lwepp/util/pool had no test file, leaving InferencePoolToEndpointPool at 0% coverage.

The function sits on the reconciler's hot path. InferencePoolReconciler.Reconcile passes its result straight into Datastore.PoolSet, which is what decides the label selector the datastore uses to pick endpoints. A regression in the conversion does not fail loudly, it silently changes which pods receive inference traffic, so it is worth pinning down.

This adds a table-driven test covering:

  • nil input returns nil, which the reconciler relies on since PoolSet treats a nil pool as a Clear()
  • selector, target ports and namespace all carried across
  • target port ordering preserved
  • empty label value preserved, since the API permits it and it selects pods carrying the key with an empty value rather than dropping the key
  • port numbers at both ends of the valid range, pinning the PortNumber int32 to int narrowing
  • empty spec yielding empty but non-nil Selector and TargetPorts, which is the current contract and distinguishable from nil at the call site

Package coverage goes from 0% to 100% of statements.

I checked the test actually fails when the behaviour breaks rather than only passing: dropping the Namespace assignment fails the suite, and removing the nil guard panics it.

Tests only, no production code touched.

Which issue(s) this PR fixes:

None.

Does this PR introduce a user-facing change?:

NONE

The conversion had no test coverage. It is on the reconciler's hot path:
every InferencePool reconcile passes its result to Datastore.PoolSet, so a
regression here silently changes which pods the datastore selects rather
than failing loudly.

Adds table-driven cases for the nil input, full selector/port/namespace
conversion, target port ordering, and the empty-spec case that yields
empty but non-nil Selector and TargetPorts. Package coverage 0% to 100%.

Signed-off-by: Kush Zingade <[email protected]>
@kubernetes-prow

Copy link
Copy Markdown

@UgaTheDev: The label(s) kind/test cannot be applied, because the repository doesn't have them.

Details

In response to this:

What type of PR is this?
/kind test

What this PR does / why we need it:

pkg/lwepp/util/pool had no test file, leaving InferencePoolToEndpointPool at 0% coverage.

The function sits on the reconciler's hot path. InferencePoolReconciler.Reconcile passes its result straight into Datastore.PoolSet, which is what decides the label selector the datastore uses to pick endpoints. A regression in the conversion does not fail loudly, it silently changes which pods receive inference traffic, so it is worth pinning down.

This adds a table-driven test covering:

  • nil input returns nil, which the reconciler relies on since PoolSet treats a nil pool as a Clear()
  • selector, target ports and namespace all carried across
  • target port ordering preserved
  • empty label value preserved, since the API permits it and it selects pods carrying the key with an empty value rather than dropping the key
  • port numbers at both ends of the valid range, pinning the PortNumber int32 to int narrowing
  • empty spec yielding empty but non-nil Selector and TargetPorts, which is the current contract and distinguishable from nil at the call site

Package coverage goes from 0% to 100% of statements.

I checked the test actually fails when the behaviour breaks rather than only passing: dropping the Namespace assignment fails the suite, and removing the nil guard panics it.

Tests only, no production code touched.

Which issue(s) this PR fixes:

None.

Does this PR introduce a user-facing change?:

NONE

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@netlify

netlify Bot commented Aug 1, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for gateway-api-inference-extension ready!

Name Link
🔨 Latest commit d484089
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/6a6dd9d92e885a00082d3677
😎 Deploy Preview https://deploy-preview-3011--gateway-api-inference-extension.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 1, 2026
@kubernetes-prow

Copy link
Copy Markdown

Hi @UgaTheDev. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubernetes-prow kubernetes-prow Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 1, 2026
@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: UgaTheDev
Once this PR has been reviewed and has the lgtm label, please assign ahg-g for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow
kubernetes-prow Bot requested review from danehans and elevran August 1, 2026 11:34
@kubernetes-prow kubernetes-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 1, 2026
@UgaTheDev

Copy link
Copy Markdown
Contributor Author

/kind cleanup

@kubernetes-prow kubernetes-prow Bot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Aug 1, 2026
@UgaTheDev

Copy link
Copy Markdown
Contributor Author

@ahg-g thanks for going through #3010 and #3013. This one is still on needs-ok-to-test so CI has not run on it yet. Could you add /ok-to-test when you get a chance? It is test-only coverage for InferencePoolToEndpointPool, no production code changes.

@ahg-g

ahg-g commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

/ok-to-test

@kubernetes-prow kubernetes-prow Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 10, 2026
@ahg-g
ahg-g merged commit 4d77e1c into kubernetes-sigs:main Aug 10, 2026
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

2 participants