-
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 workload cluster unit tests in KCP #2806
🏃Add workload cluster unit tests in KCP #2806
Conversation
2dc4a32
to
bc53d5b
Compare
/hold |
/hold remove |
/hold cancel |
/milestone v0.3.4 |
@benmoss FYI, after this PR merges, your changes might need a rebase given that we're moving the etcd methods to a different file |
I'm going to rebase this into a single commit. |
673d98d
to
65b26ef
Compare
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.
/approve
/assign @benmoss
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vincepri, wfernandes 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 |
}{ | ||
{ | ||
name: "does not panic if machine is nil", | ||
expectErr: false, |
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.
These "does not panic" tests also seem weird, it would be nice to assert something positive like that the k8s and etcd clients aren't called
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...I wasn't sure the best way to test this. I know gomega has the Panic() assertion.
But if the nil
checks are removed it's going to panic regardless because it's calling removeMemberForNode(ctx, machine.Status.NodeRef.Name)
. And I decided that a panic is a failing test.
I added this test case just to document the behavior and not lose it.
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 is, if someone remove the nil checks, these tests gonna blow up.
expectErr bool | ||
}{ | ||
{ | ||
name: "does not panic if machine is nil", |
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.
same as above
Other than those readability nits it seems good 👍 |
- Move private and helpers to the bottom of file - Move etcd methods into separate file - Add test for RemoveEtcdMemberForMachine - Add test for RemoveMachineFromKubeadmConfigMap - Add test for UpdateEtcdVersionInKubeadmConfigMap - Add test for ForwardEtcdLeadership - Add test for UpdateKubeletConfigMap - Add test for UpdateKubernetesVersionInKubeadmConfigMap - Add test for ClusterStatus - Use kubeadm-config as a const
65b26ef
to
d821cd5
Compare
/lgtm |
What this PR does / why we need it:
This PR backfills unit tests for KCP/workload_cluster components
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Ref #2753
#2779