-
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 test for machine controller reconcile #650
Add unit test for machine controller reconcile #650
Conversation
Hi @enxebre. Thanks for your PR. I'm waiting for a kubernetes-sigs or kubernetes 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. |
/lgtm |
@enxebre: This appears to conflict with an existing tests:
|
/ok-to-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.
pkg/controller/machine/controller.go
Outdated
}, | ||
}, | ||
} | ||
err := c.Client.List(ctx, listOptions, &clusterList) |
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.
nit: This should be cuddled, e.g. if err := c.Client.List(...); err != nil { ... }
e874214
to
9efd834
Compare
@roberthbailey I changed the unit introduced here to |
/lgtm |
9efd834
to
6ec3bdd
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.
/lgtm
/assign @roberthbailey @justinsb |
) | ||
|
||
func TestReconcileRequest(t *testing.T) { | ||
m1 := v1alpha1.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.
Please, use at least three letters long identifiers:
- s/m1/machine1/
- s/m2/machine2/
- s/m3/machine3/
- s/c/cluster/
- s/cl/clusterList/
E.g. c
identifies are very hard to find (as other identifiers contain the c
letter), m1
(m, one) tends to look like (m, l), the same for cl
(c, l) as (c, one).
DeletionTimestamp: &time, | ||
}, | ||
} | ||
c := v1alpha1.Cluster{ |
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.
Not sure if it is used only once. Though, if so, it can be embedded into ClusterList
.
} | ||
testCases := []struct { | ||
request reconcile.Request | ||
ExistsValue bool |
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.
Does the field need to be exported? existsValue
will do as well otherwise.
} | ||
|
||
for _, tc := range testCases { | ||
a := newTestActuator() |
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.
s/a/act
, s/a/actuator
or s/a/tesActuator
Can you also extend var _ Actuator = &TestActuator{} ? So the fact that |
6ec3bdd
to
63b02d9
Compare
It looks like there are a couple of outstanding comments from @ingvagabund. Can you address / resolve those and then we can merge this. |
63b02d9
to
16031bd
Compare
/test pull-cluster-api-test |
16031bd
to
abc48d6
Compare
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: enxebre, roberthbailey 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 |
Update CAPBK to v0.1.5
What this PR does / why we need it:
Add uni test for machine controller reconcile
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 #
Special notes for your reviewer:
Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.
Release note: