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

refactor(tests): assert.Error -> require.Error (other unit tests) #13399

Merged
merged 1 commit into from
Jul 28, 2024

Conversation

Joibel
Copy link
Member

@Joibel Joibel commented Jul 26, 2024

This is part of a series of test tidies started by #13365.

The aim is to enable the testifylint golangci-lint checker.

This commit converts assert.Error checks into require.Error for the part of the codebase, as per #13270 (comment)

In some places checks have been coalesced - in particular the pattern

if assert.Error() {
    assert.Contains(..., "message")
}

is now

require.ErrorContains(..., "message")

Getting this wrong and missing the Contains is still valid Go, so that's a mistake I may have made.

Signed-off-by: Alan Clucas alan@clucas.org

Base automatically changed from testifylint-automated-fix to main July 27, 2024 16:05
@agilgur5 agilgur5 changed the title chore(tests): assert.Error->require.Error (other unit tests) refactor(tests): assert.Error -> require.Error (other unit tests) Jul 27, 2024
@agilgur5
Copy link
Member

@Joibel looks like this one still needs a rebase from #13396

This is part of a series of test tidies started by #13365.

The aim is to enable the testifylint golangci-lint checker.

This commit converts assert.Error checks into require.Error for the
part of the codebase, as per #13270 (comment)

In some places checks have been coaleced - in particular the pattern

```go
if assert.Error() {
    assert.Contains(..., "message")
}
```

is now
```go
require.ErrorContains(..., "message")
```

Getting this wrong and missing the Contains is still valid go, so
that's a mistake I may have made.

Signed-off-by: Alan Clucas <alan@clucas.org>
@Joibel Joibel force-pushed the testifylint-require-other branch from e4ec409 to 86c259e Compare July 27, 2024 21:03
@agilgur5 agilgur5 merged commit 2cb9118 into main Jul 28, 2024
28 checks passed
@agilgur5 agilgur5 deleted the testifylint-require-other branch July 28, 2024 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants