-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
chore(linters): Fix findings found by testifylint
: go-require
for zabbix
#15727
chore(linters): Fix findings found by testifylint
: go-require
for zabbix
#15727
Conversation
req, err := listenForZabbixMetric(t, listener, len(test.zabbixMetrics) == 0) | ||
if err != nil { | ||
innerErrs <- err | ||
} else { | ||
success <- req | ||
} |
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.
How about encapsulating the listener
stuff in a zabbixMockServer
struct and record the received messages and errors there instead of utilizing channels to pass around data. We then perform the test, wait for the required data (with timeout) and then check the recorded internal data (and errors). This also allows to stick with require
instead of reintroducing assert
... What do you think?
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.
Utilized zabbixMockServer
and simplfied things.
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
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.
Looks good thanks @zak-pawel!
Summary
This is only the first part of a larger effort to address the findings identified by
testifylint: go-require
: #15535Once all the findings have been addressed,
testifylint: go-require
can be enabled in.golangci.yml
.In this PR, I'm focusing on just one test file:
zabbix_test.go
, to start a discussion on whether this approach to fixinggo-require
issues works for us.Here are the findings that this PR addresses:
Checklist