Repository navigation
test(knative): add unit test suite for KService resource class - #1091
Open
vikash7485 wants to merge 1 commit into
Open
vikash7485 wants to merge 1 commit into
vikash7485 wants to merge 1 commit into
Conversation
vikash7485
requested review from
ashu8912,
illume,
joaquimrocha,
skoeva,
sniok,
vyncent-t and
yolossn
as code owners
August 9, 2026 12:04
illume
requested changes
Sep 29, 2026
illume
left a comment
Contributor
There was a problem hiding this comment.
Thanks for working on this.
The commit messages could use some tidying up to match our contribution guidelines. We use Linux kernel style — the contributing guide has the details, and git log shows good examples.
Commits that need attention
test(knative): add unit test suite for KService resource class— Missingarea: descriptionprefix — e.g.frontend: HomeButton: Fix so it navigates to homeorbackend: config: Add enable-dynamic-clusters flag.
Commit guidelines
- Use atomic commits focused on a single change.
- Use the title format
<area>: <Description of changes>— description must start with a capital letter. - Keep the title under 72 characters (soft requirement).
- Explain the intention and why the change is needed.
- Make commit titles meaningful and describe what changed.
- Do not add code that a later commit rewrites; squash or reorder commits instead.
- Do not include
Fixes #NNin commit messages.
Good examples:
frontend: HomeButton: Fix so it navigates to homebackend: config: Add enable-dynamic-clusters flag
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Two autoscaling annotation mappings used by the UI remain untested.
Review effort: Balanced
Findings: 1
What changed in this PR
Adds unit coverage for Knative’s KService resource class.
Changes:
- Tests metadata, routes, autoscaling patches, status getters, and defaults.
- Adds Vitest aliases for Headlamp Kubernetes modules.
| File | Description |
|---|---|
knative/vitest.config.mts |
Configures test module resolution. |
knative/src/resources/knative/kservice.test.ts |
Adds the KService unit suite. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Add unit test coverage for the KService resource class including static metadata, routes, autoscaling patches with scale bounds annotations, readiness and URL getters, and default base resource template. Signed-off-by: vikash7485 <vikkiraj073@gmail.com>
vikash7485
force-pushed
the
test/kservice-resource-unit-tests
branch
from
September 30, 2026 17:23
6c154e1 to
9607ad9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
This PR adds a comprehensive unit test suite for the
KServicecustom resource class (plugins/knative/src/resources/knative/kservice.ts), covering static CRD metadata, route definitions, default base object creation, URL/readiness getters, and autoscaling patch body creation.Covered Test Scenarios (
plugins/knative/src/resources/knative/kservice.test.ts):kind,apiName,apiVersion,isNamespaced) and route paths (detailsRoute,listRoute).buildAutoscalingPatch():nullwhen all autoscaling input parameters areundefined.metric,target,minScale,maxScale,targetUtilization,scaleDownDelay, andstableWindow.containerConcurrency.url&isReady):status.urlandReadycondition are present.status.address.urlwhenstatus.urlis missing.urlreturnsundefined,isReadyreturnsfalse).getBaseObject(): Asserts default base object configuration template.How Has This Been Tested?
npx tsc --noEmit(0 errors).npx eslint).npx vitest run(38/38 unit tests passing across 6 test files).