Skip to content

Add unit tests for statusViewer#143

Open
GautamBytes wants to merge 1 commit intoopenkruise:masterfrom
GautamBytes:add-ut-for-statusviewer
Open

Add unit tests for statusViewer#143
GautamBytes wants to merge 1 commit intoopenkruise:masterfrom
GautamBytes:add-ut-for-statusviewer

Conversation

@GautamBytes
Copy link
Copy Markdown
Contributor

What this PR does / why we need it

This pull request introduces comprehensive unit tests for the statusViewer function within the pkg/internal/polymorphichelpers package. Currently, this function lacks test coverage, making it susceptible to future regressions.

The new tests verify the core logic by:

  1. Confirming Success: Ensures a valid StatusViewer is returned for known resource kinds like apps/Deployment.
  2. Verifying Failure: Ensures an error is returned for unknown resource kinds.
  3. Handling Edge Cases: Explicitly tests that a nil input causes a panic, which is the current behavior of the function.

How to test this PR

This PR only adds a test file. The changes can be verified by running the test suite for the package:

go test ./pkg/internal/polymorphichelpers

Signed-off-by: GautamBytes <manchandanigautam@gmail.com>
@kruise-bot kruise-bot requested review from furykerry and hantmac July 11, 2025 18:01
@kruise-bot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign fillzpp for approval by writing /assign @fillzpp in a comment. For more information see:The Kubernetes 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

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants