test(): correct mock client type and remove deprecated ClusterName field in tests#404
Open
Shreesha001 wants to merge 1 commit into
Open
test(): correct mock client type and remove deprecated ClusterName field in tests#404Shreesha001 wants to merge 1 commit into
Shreesha001 wants to merge 1 commit into
Conversation
pnavali
approved these changes
Jul 1, 2026
There was a problem hiding this comment.
Pull request overview
This PR fixes unit-test build failures by updating test scaffolding to use the correct mock client type (so testify/mock expectations work) and by removing usage of a deprecated/removed Kubernetes API field in test object literals.
Changes:
- Updated test helper context-preparation functions to accept
*util/mocks.Clientinstead of the previously referencedutil.Client. - Removed the deprecated
ObjectMeta.ClusterNamefield from ametav1.ObjectMetaliteral in a worker slice gateway service test. - Cleaned up
testingimport placement inaccess_control_service_test.go.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
service/worker_slice_gateway_service_test.go |
Removes deprecated ObjectMeta.ClusterName usage that can break builds with newer Kubernetes API versions. |
service/project_service_test.go |
Adjusts helper signature to accept the actual testify mock client type used by tests. |
service/namespace_service_test.go |
Adjusts helper signature to accept the actual testify mock client type used by tests. |
service/access_control_service_test.go |
Adjusts helper signature to accept the actual testify mock client type used by tests and tidies imports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gourishkb
approved these changes
Jul 6, 2026
… in tests Signed-off-by: Shreesha001 <shettyshreesha552@gmail.com>
c9d8a67 to
9c6487a
Compare
| } | ||
|
|
||
| func prepareACSTestContext(ctx context.Context, client util.Client, | ||
| func prepareACSTestContext(ctx context.Context, client *utilMock.Client, |
| } | ||
|
|
||
| func prepareNamespaceTestContext(ctx context.Context, client util.Client, scheme *runtime.Scheme) context.Context { | ||
| func prepareNamespaceTestContext(ctx context.Context, client *utilMock.Client, scheme *runtime.Scheme) context.Context { |
Comment on lines
+279
to
280
| func prepareProjectTestContext(ctx context.Context, client *utilMock.Client, | ||
| scheme *runtime.Scheme) context.Context { |
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
Fixes build failures in test files caused by incorrect mock client type usage and deprecated Kubernetes API fields.
Changes
util.Clientwith*utilMock.Clientin test helper functions , required for testify mocks to work correctlyClusterNamefield fromObjectMetastruct literals.Fixes #
How Has This Been Tested?
make unit-testChecklist
Does this PR introduce a breaking change for other components like worker-operator?
No.