Closed pohly closed 1 year ago
Is your feature request related to a problem? Please describe.
https://github.com/onsi/gomega/commit/2b39142b16e69fa9405d5c7401dc62a5776a9bf5 in Gomega 1.29.0 extended MatchError so that a function + string is another valid option. It would be good to check for valid combinations of parameters via static analysis.
MatchError
Valid:
MatchError(string|error|matcher)
MatchError(func(error) bool, string)
Valid, but useless:
MatchError(string|error|matcher, string)
Invalid:
Additional context
In Kubernetes, we are replacing Expect(err).To(HaveOccurred()) or framework.ExpectError(err) with checks that the right error occurred. The callback functions are e.g. apierrors.IsNotFound.
Expect(err).To(HaveOccurred())
framework.ExpectError(err)
apierrors.IsNotFound
Sound good. Thanks for the idea, @pohly
And thanks for the tip. Implemented also here: https://github.com/kubevirt/hyperconverged-cluster-operator/pull/2578
Is your feature request related to a problem? Please describe.
https://github.com/onsi/gomega/commit/2b39142b16e69fa9405d5c7401dc62a5776a9bf5 in Gomega 1.29.0 extended
MatchError
so that a function + string is another valid option. It would be good to check for valid combinations of parameters via static analysis.Valid:
MatchError(string|error|matcher)
MatchError(func(error) bool, string)
Valid, but useless:
MatchError(string|error|matcher, string)
Invalid:
Additional context
In Kubernetes, we are replacing
Expect(err).To(HaveOccurred())
orframework.ExpectError(err)
with checks that the right error occurred. The callback functions are e.g.apierrors.IsNotFound
.