Skip to content

Commit

Permalink
chore: enable require-error rule from errorlint linter on pkg folder (a…
Browse files Browse the repository at this point in the history
…rgoproj#18691)

Signed-off-by: Matthieu MOREL <[email protected]>
  • Loading branch information
mmorel-35 authored and ggjulio committed Jul 21, 2024
1 parent 09313fb commit a58ca11
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ issues:
- SA1019
- SA5011
exclude-rules:
- path: "(applicationset|cmpserver|controller|pkg|reposerver)/"
- path: "(applicationset|cmpserver|controller|reposerver)/"
text: "require-error:"
linters:
- testifylint
Expand Down
5 changes: 3 additions & 2 deletions pkg/apiclient/apiclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func Test_parseHeaders(t *testing.T) {
t.Run("Header parsed successfully", func(t *testing.T) {
headerString := []string{"foo:", "foo1:bar1", "foo2:bar2:bar2"}
headers, err := parseHeaders(headerString)
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, "", headers.Get("foo"))
assert.Equal(t, "bar1", headers.Get("foo1"))
assert.Equal(t, "bar2:bar2", headers.Get("foo2"))
Expand All @@ -27,7 +28,7 @@ func Test_parseGRPCHeaders(t *testing.T) {
t.Run("Header parsed successfully", func(t *testing.T) {
headerStrings := []string{"origin: https://foo.bar", "content-length: 123"}
headers, err := parseGRPCHeaders(headerStrings)
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, []string{" https://foo.bar"}, headers.Get("origin"))
assert.Equal(t, []string{" 123"}, headers.Get("content-length"))
})
Expand Down
Loading

0 comments on commit a58ca11

Please sign in to comment.