-
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 Unit tests for reconcileDelete #11636
base: main
Are you sure you want to change the base?
Conversation
This PR is currently missing an area label, which is used to identify the modified component when generating release notes. Area labels can be added by org members by writing Please see the labels list for possible areas. 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-sigs/prow repository. |
Welcome @arshadd-b! |
Hi @arshadd-b. 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-sigs/prow repository. |
/ok-to-test |
9a4081f
to
fc4ae67
Compare
Hi @sbueringer
could you please guide me how i can cover these cases as well ? |
/retest |
reconcileDeleteCache: cache.New[cache.ReconcileEntry](), | ||
} | ||
|
||
cluster := testCluster.DeepCopy() |
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.
this probably worth a comment on why is needed
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.
Actually it is not needed to make a copy, so removed it
expectNodeDeletion: false, | ||
expectDeletingReason: clusterv1.MachineDeletingDrainingNodeV1Beta2Reason, | ||
annotations: map[string]string{ | ||
"machine.cluster.x-k8s.io": "", |
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.
whats the purpose of this annotation?
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.
This is case when we don't want to exclude node draining , we want to check for Node Drain and will return an error
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.
that's regular behaviour right? which effect would have setting an annotation key "machine.cluster.x-k8s.io" within a Machine CR?
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.
yes it is regular behaviour. I had gone through Machine CR . I have changed this to a valid annotaion here
fe1a466#diff-eca451c4058d015075de4b1e9713d6154e1d50f7d4595df4218d87fb0163bc20R3670
} | ||
} | ||
|
||
func TestNodeDeletionWithPreDrainHook(t *testing.T) { |
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.
why isn't this one a test case of the above?
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.
In this testCase, need some custom object to be passed here in the client
https://github.com/kubernetes-sigs/cluster-api/pull/11636/files#diff-eca451c4058d015075de4b1e9713d6154e1d50f7d4595df4218d87fb0163bc20R3858
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
43b39a0
to
fe1a466
Compare
fe1a466
to
cb8e89c
Compare
}, | ||
} | ||
|
||
cpmachine1 := &clusterv1.Machine{ |
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 might be missing something, is cpmachine1
used in the test?
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.
yeah, Actually it is used here while creating Fake client
https://github.com/kubernetes-sigs/cluster-api/pull/11636/files#diff-eca451c4058d015075de4b1e9713d6154e1d50f7d4595df4218d87fb0163bc20R3689
What this PR does / why we need it:
ThIs improves test coverage of Machine Controller reconcileDelete
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes # #11626