Skip to content
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

managedcluster-controller tests #830

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

BROngineer
Copy link
Contributor

Fixes: #822

@BROngineer BROngineer force-pushed the fix/issue-822-managedcluster-controller-test branch 5 times, most recently from 20e9cdb to 8010dd2 Compare December 27, 2024 23:38
@BROngineer BROngineer marked this pull request as ready for review December 28, 2024 21:05
Copy link
Member

@zerospiel zerospiel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comments, please consider to address

Comment on lines +49 to +59
getter := NewMemoryRESTClientGetter(a.Config, a.RESTMapper)
actionConfig := new(action.Configuration)
err := actionConfig.Init(getter, clusterDeployment.Namespace, "secret", log)
if err != nil {
return nil, err
}
return actionConfig, nil
Copy link
Member

@zerospiel zerospiel Dec 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
getter := NewMemoryRESTClientGetter(a.Config, a.RESTMapper)
actionConfig := new(action.Configuration)
err := actionConfig.Init(getter, clusterDeployment.Namespace, "secret", log)
if err != nil {
return nil, err
}
return actionConfig, nil
actionConfig := new(action.Configuration)
return actionConfig, actionConfig.Init(NewMemoryRESTClientGetter(a.Config, a.RESTMapper), clusterDeployment.Namespace, "secret", log)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zerospiel is it ok for our code-style, that the function returning pointer and error, will return pointer to type's zero value along with an error? Isn't it more correct to return nil, err in case of error and value, nil in case no error occurred?

Besides that, is it really worth packing all calls into a single-line return if it doesn't affect anything other than readability (which is very subjective measurement)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just nitting, it was a suggestion obviously to my own style/preferences , up to the developer though

internal/controller/template_controller_test.go Outdated Show resolved Hide resolved
internal/controller/template_controller_test.go Outdated Show resolved Hide resolved
internal/controller/clusterdeployment_controller_test.go Outdated Show resolved Hide resolved
Signed-off-by: Artem Bortnikov <[email protected]>
Signed-off-by: Artem Bortnikov <[email protected]>
Signed-off-by: Artem Bortnikov <[email protected]>
Signed-off-by: Artem Bortnikov <[email protected]>
Signed-off-by: Artem Bortnikov <[email protected]>
@BROngineer BROngineer force-pushed the fix/issue-822-managedcluster-controller-test branch from fe7bc24 to 58f8620 Compare December 30, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

ManagedCluster controller test enhancement
2 participants