test(knative): add unit test suite for KRevision resource class - #1100
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 17:04
illume
requested changes
Sep 29, 2026
illume
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the contribution.
Could you take a look at the commit messages in this PR? We follow a Linux kernel style for git commits — see the contributing guide and git log for examples.
Commits that need attention
test(knative): add unit test suite for KRevision 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
🟢 Approval recommended
Coverage matches the implementation; only a minor test-name mismatch remains.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds unit coverage for the Knative KRevision resource class.
Changes:
- Tests metadata, routes, readiness, labels, and containers.
- Tests direct and latest-revision traffic matching.
| File | Description |
|---|---|
knative/src/resources/knative/revision.test.ts |
Adds the KRevision unit test 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 KRevision resource class including static metadata, routes, readiness, parent service label, containers, primary image, and traffic resolution in service. Signed-off-by: vikash7485 <vikkiraj073@gmail.com>
vikash7485
force-pushed
the
test/krevision-resource-unit-tests
branch
from
September 30, 2026 17:30
9532603 to
9768db1
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
KRevisioncustom resource class (plugins/knative/src/resources/knative/revision.ts), which handles Knative Revision resource parsing, condition status evaluation, and traffic split target calculation.Prior to this PR,
revision.tshad zero test coverage.Covered Test Scenarios (
plugins/knative/src/resources/knative/revision.test.ts):kind,apiName,apiVersion,isNamespaced) and route paths (detailsRoute,listRoute).isReady&readyCondition):Readycondition isTrue.falsewhenReadycondition status isFalseor missing.parentService):serving.knative.dev/servicemetadata label.undefinedwhen label is omitted.containers&primaryImage):containers[0].image).undefinedwhen spec is empty.getTrafficInService):kserviceisnull.revisionName.latestRevisiontargets whenlatestReadyRevisionNameequals the revision name.How Has This Been Tested?
npx tsc --noEmit(0 errors).npx eslint).npx vitest run(All 43 unit tests passing across 6 test files).