-
Notifications
You must be signed in to change notification settings - Fork 557
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
🌱 test: add failure message to Eventually().Should(bool) everywhere #4943
🌱 test: add failure message to Eventually().Should(bool) everywhere #4943
Conversation
/assign @nrb @richardcase |
c0bcd79
to
c7e937e
Compare
/lgtm |
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.
Otherwise LGTM and great change!
@@ -58,7 +58,7 @@ func waitForMachineDeploymentDeleted(ctx context.Context, input waitForMachineDe | |||
err := input.Getter.Get(ctx, key, mp) | |||
notFound := apierrors.IsNotFound(err) | |||
return notFound | |||
}, intervals...).Should(BeTrue()) | |||
}, intervals...).Should(BeTrue(), fmt.Sprintf("Eventually failed waiting for MachineDeployment %s to be deleted", input.MachineDeployment.GetName())) |
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.
Can you please change all occurrences into %q
instead of %s
? If a value is empty by mistake, which is very likely when writing tests, it's super-hard to see two spaces as compared to a quoted string that clearly says it's empty: waiting for MachineDeployment to be deleted
vs. waiting for MachineDeployment "" to be deleted
.
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.
Good suggestion! Updated thanks Andreas!
c7e937e
to
e6ffff5
Compare
e6ffff5
to
a7c55e1
Compare
/test pull-cluster-api-provider-aws-e2e |
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 @richardcase @dlipovetsky |
/approve Thanks for improving the tests! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dlipovetsky 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 |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
In Gomega, when Eventually().Should() fails, the failure returns a
Which takes a bit of time to then debug further.
There is a more immediate way to add some context to this, by adding a failure message to the should like so:
.Should(x, "message")
. This PR does this for all the current occurrences of this construct.Release note: