Skip to content

Add unit tests for pkg/util/secret #2104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GautamBytes
Copy link
Contributor

What this PR does

This PR introduces a unit test suite for the utility functions in pkg/util/secret/parse.go, which are responsible for extracting image pull credentials from Kubernetes Secrets.

in support of issue #2074

Why is this change necessary?

This part of the codebase handles critical authentication logic but lacked unit tests. Adding tests ensures that the credential lookup, including its fallback behavior, is reliable and can be safely refactored in the future. This change increases test coverage and overall project stability.

How to test

All new tests pass successfully. This can be verified by running:

go test ./pkg/util/secret -v

Signed-off-by: GautamBytes <[email protected]>
@kruise-bot kruise-bot requested review from FillZpp and zmberg July 9, 2025 12:28
@kruise-bot
Copy link

[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 fei-guo for approval by writing /assign @fei-guo 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.

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

@kruise-bot kruise-bot added the size/L size/L: 100-499 label Jul 9, 2025
@furykerry
Copy link
Member

newly added ut fails, plz check it out

@GautamBytes
Copy link
Contributor Author

newly added ut fails, plz check it out

Sure will fix it by EOD. Btw i have added uts for kruise-tools repo also. Workflows for each ut are passing , would you check them once also?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L size/L: 100-499
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants