-
Notifications
You must be signed in to change notification settings - Fork 64
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 the ginkgolinter and fix findings #225
Conversation
Pull Request Test Coverage Report for Build 4181316724
💛 - Coveralls |
cf0e5d4
to
1755441
Compare
/ok-to-test |
eb97cb1
to
7680733
Compare
Eventually(func() error { | ||
Eventually(func(g Gomega) { | ||
machineList := &infrav1.KubevirtMachineList{} | ||
err := k8sclient.List(context.Background(), machineList, client.InNamespace(namespace)) | ||
if err != nil { | ||
return err | ||
} | ||
g.Expect( | ||
k8sclient.List(context.Background(), machineList, client.InNamespace(namespace)), | ||
).To(Succeed()) | ||
|
||
if len(machineList.Items) == 0 { | ||
return fmt.Errorf("expecting a non-empty list of machines") | ||
} | ||
g.Expect(machineList.Items).ToNot(BeEmpty(), "expecting a non-empty list of machines") | ||
|
||
for _, machine := range machineList.Items { | ||
if !conditions.IsTrue(&machine, infrav1.BootstrapExecSucceededCondition) { | ||
return fmt.Errorf("still waiting on a kubevirt machine with bootstrap succeeded condition") | ||
} | ||
g.Expect(conditions.IsTrue(&machine, infrav1.BootstrapExecSucceededCondition)).To( | ||
BeTrue(), | ||
"still waiting on a kubevirt machine with bootstrap succeeded condition", | ||
) | ||
} |
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.
We're waiting to "eventually" have this loop pass without errors. By introducing the g.Expect logic in this loop, will the eventually loop still be eventually consistent once no errors are encountered?
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.
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.
oh perfect. okay
/retest |
In addition to the ginkgo linter findings, replace this pattern: ```go err = funcRetErr() Expect(err).ToNot(HaveOccurred()) ``` With the more readable version of: ```go Expect(funcRetErr()).To(Succeed()) ``` Improve some Eventually usages by using the Gomega parameter instead of returning error, to get cleaner test code. Also, replaced some deprecation methods. Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>
7680733
to
c5ff039
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
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: davidvossel, nunnatsa 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 |
In addition to the ginkgo linter findings, replace this pattern:
With the more readable version of:
Improve some
Eventually
usages by using the Gomega parameter instead of returning error, to get cleaner test code.Also, replaced some deprecation methods.
Signed-off-by: Nahshon Unna-Tsameret nunnatsa@redhat.com
What this PR does / why we need it:
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
Release notes: