-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
🌱 Add tests for ensureNamespace #3217
🌱 Add tests for ensureNamespace #3217
Conversation
Hi @hazbo. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
ensureNamespaces
func…
/assign @fabriziopandini @wfernandes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hazbo thanks!
only few minors to simplify the test and make them more readable/maintainable
Could you provide more context? |
facd118
to
232cae9
Compare
/ok-to-test |
Yes I'll go into a bit more detail here. Originally I was writing a test for So then I started digging deeper, and that is where this PR comes from. EDIT: I've since written some tests for |
only one tiny nit, then lgtm for me; please squash commits |
1487224
to
a2194a3
Compare
…tion, not to be confused with the `ensureNamespace` test I have in this commit. Upon testing `ensureNamespaces`, I think I've come across a few bugs. This function itself makes a call to `ensureNamespace` and it seems like there is potentially a scoping issue with where `err` is being set. It is my understanding that the following pattern: if err := something(); err != nil { } implies that this particular error is available within the scope locally. You can test out the differece by reverting the small change made in `mover.go` to see the different in behaviour. `ensureNamespaces` still needs a test written. Simplified test code to be more readable As per the kind suggestions, I have made changes to reflect those comments in this commit. Update cmd/clusterctl/client/cluster/mover.go Co-authored-by: Vince Prignano <vince@vincepri.com> Updated misleading comment We're no longer passing extra params here. Updated comment again Removed TypeMeta in namespace
a2194a3
to
fd43486
Compare
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fabriziopandini The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thanks for this PR! |
mover := objectMover{ | ||
fromProxy: test.NewFakeProxy(), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Great work! Just wondering, is fromProxy
required here or can we leave it as a zero value? It doesn't seem to be used in these test cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that the tests pass with fromProxy
being removed here
What this PR does / why we need it:
#2252 requires a test for
ensureNamespaces
. This PR includes a test forensureNamespace
(which is called insideensureNamespaces
) and also I think a bug fix regarding the scope of anerr
.In writing new tests for
ensureNamespaces
, I've found some odd behavior there which needs addressing. A test for that function is not in this PR.Edit: this is in relation to my previous PR #2984