-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
refactor(tests): testifylint automated fixes #13396
Conversation
This is part of a series of test tidies started by #13365. The aim is to enable the testifylint golangci-lint checker. This patch is just the automated fixes excluding the removal of the t.Parallel from `cron_test.go`. Some fixes like ```go assert.True(t, len(pods.Items) > 0, "pod was not created successfully") ``` went to ```go assert.Positive(t, pods.Items, "pod was not created successfully") ``` and I have manually converted these to ```go assert.NotEmpty(t, pods.Items, "pod was not created successfully") ``` `test/e2e/agent_test.go` also needed `0`->`time.Duration(0)` for one `assert.Equal`. Signed-off-by: Alan Clucas <[email protected]>
fcdc510
to
879d23a
Compare
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, these all look like great changes to me, hopefully we can get the tool into CI soon.
The nicer assertions make the code easier to read and, perhaps more importantly, will make test failures much easier to read.
Switching it on is as simple as adding it to --- a/.golangci.yml
+++ b/.golangci.yml
@@ -33,6 +33,7 @@ linters:
- rowserrcheck
- sqlclosecheck
- staticcheck
+ - testifylint
- typecheck
- unparam
- unused The remaining work (outside of all the require PRs) is:
The temporary downside is that merged PRs from CI that happened before the linter enablement may fail the linter after merge. We'll just have to deal with it as it happens. |
could also temporarily add a lint ignore
You mentioned |
This is part of a series of test tidies started by #13365.
The aim is to enable the testifylint golangci-lint checker.
This patch is just the automated fixes (
testifylint --fix
) excluding the removal of thet.Parallel
fromcron_test.go
.Some fixes like
went to
and I have manually converted these to
test/e2e/agent_test.go
also needed0
->time.Duration(0)
for oneassert.Equal
.Note to maintainers: Please feel free to apply fixes yourself to this PR