Skip to content
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

[BUG] Custom GomegaMatcher Incorrectly Compares to MatchError #125

Closed
sam-heilbron opened this issue Dec 19, 2023 · 1 comment
Closed

[BUG] Custom GomegaMatcher Incorrectly Compares to MatchError #125

sam-heilbron opened this issue Dec 19, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@sam-heilbron
Copy link

Describe the bug
When I define a custom GomegaMatcher in a test, and then run the linter against that code, I see:

ginkgo-linter: the MatchError matcher used to assert a non error type (<type>)

To Reproduce
Option 1:

  1. Write a test that relies on a custom GomegaMatcher
  2. Run the linter against that file

Option 2:

  1. Run the linter agains the code in https://github.com/solo-io/gloo

When I use option 2, I see a bunch of errors, like:

string, GomegaMatcher or func(error)bool are allowed
/Users/samheilbron/go/src/github.com/solo-io/gloo/test/kube2e/gateway/gateway_test.go:2119:6: ginkgo-linter: the MatchError matcher used to assert a non error type (err.Error())
/Users/samheilbron/go/src/github.com/solo-io/gloo/test/kube2e/gateway/gateway_test.go:2119:29: ginkgo-linter: MatchError first parameter (matchers2.ContainSubstrings([]string{"admission webhook", "SSL secret not found", secretName})) must be error, string, GomegaMatcher or func(error)bool are allowed
/Users/samheilbron/go/src/github.com/solo-io/gloo/test/kube2e/gateway/gateway_test.go:2281:7: ginkgo-linter: the MatchError matcher used to assert a non error type (vs.GetVirtualHost().GetOptions().GetTransformations())
/Users/samheilbron/go/src/github.com/solo-io/gloo/test/kube2e/gateway/gateway_test.go:2281:74: ginkgo-linter: MatchError first parameter (gloo_matchers.MatchProto(invalidTransformation)) must be error, string, GomegaMatcher or func(error)bool are allowed

Expected behavior
Custom GomegaMatchers, which are built correctly, should not trip a lint error

Additional context

@nunnatsa
Copy link
Owner

Thanks @sam-heilbron - this is actually the same bug as #124

Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants