-
Notifications
You must be signed in to change notification settings - Fork 38.8k
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
Make the check strict to use ExpectNoError() #78740
Conversation
d57206d
to
cf1f7d3
Compare
test/e2e/common/expansion.go
Outdated
@@ -29,7 +29,6 @@ import ( | |||
imageutils "k8s.io/kubernetes/test/utils/image" | |||
|
|||
. "github.com/onsi/ginkgo" |
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 could also remove the .
dot imports here ?
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, we could with another PR for keeping this PR scope simple and clean.
/test pull-kubernetes-bazel-build |
As kubernetes#78478 we can use ExpectNoError() instead of Expect(err).ToNot(HaveOccurred()) also. This makes the test code check strict to cover the above case and replaces the remaining in test/e2e/common/expansion.go
/retest |
1 similar comment
/retest |
/assign @k-toyoda-pi |
@@ -25,7 +25,7 @@ mapfile -t all_e2e_files < <(find test/e2e -name '*.go' | grep -v 'test/e2e/fram | |||
errors_expect_no_error=() | |||
for file in "${all_e2e_files[@]}" | |||
do | |||
if grep "Expect(.*)\.NotTo(.*HaveOccurred()" "${file}" > /dev/null | |||
if grep -E "Expect\(.*\)\.(NotTo|ToNot)\(.*HaveOccurred\(\)" "${file}" > /dev/null |
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.
verify-test-code.sh adds to detect Expect(err).ToNot(HaveOccurred())
.
But, it says about only NotTo
as the below.
The above files need to use framework.ExpectNoError(err) instead of
Expect(err).NotTo(HaveOccurred()) or gomega.Expect(err).NotTo(gomega.HaveOccurred())
Why don't you add ToNot
to error comment? Is it redundant?
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 a nice point.
As we see, ToNot
is not major and I feel it could be enough to contain NotTo
only for easy explanation.
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.
OK, I understood that.
/lgtm
/cc @BenTheElder Could you take a look at this? |
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: BenTheElder, oomichi 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:
As #78478 we can use
ExpectNoError() instead of Expect(err).ToNot(HaveOccurred()) also.
This makes the test code check strict to cover the above case and
replaces the remaining in test/e2e/common/expansion.go
Which issue(s) this PR fixes:
Ref: #77103
Does this PR introduce a user-facing change?: