Skip to content

Commit a82047f

Browse files
Archish27GitLab
authored andcommitted
Lint fixes for customaction package
1 parent c5394a4 commit a82047f

File tree

2 files changed

+23
-42
lines changed

2 files changed

+23
-42
lines changed

internal/command/shared/customaction/customaction_test.go

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"net/http"
99
"testing"
1010

11+
"github.com/stretchr/testify/assert"
1112
"github.com/stretchr/testify/require"
1213

1314
"gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver"
@@ -24,32 +25,32 @@ func TestExecuteEOFSent(t *testing.T) {
2425
Path: "/geo/proxy/info_refs_receive_pack",
2526
Handler: func(w http.ResponseWriter, r *http.Request) {
2627
b, err := io.ReadAll(r.Body)
27-
require.NoError(t, err)
28+
assert.NoError(t, err)
2829

2930
var request *Request
30-
require.NoError(t, json.Unmarshal(b, &request))
31+
assert.NoError(t, json.Unmarshal(b, &request))
3132

32-
require.Equal(t, request.Data.UserID, who)
33-
require.Empty(t, request.Output)
33+
assert.Equal(t, request.Data.UserID, who)
34+
assert.Empty(t, request.Output)
3435

3536
err = json.NewEncoder(w).Encode(Response{Result: []byte("custom")})
36-
require.NoError(t, err)
37+
assert.NoError(t, err)
3738
},
3839
},
3940
{
4041
Path: "/geo/proxy/receive_pack",
4142
Handler: func(w http.ResponseWriter, r *http.Request) {
4243
b, err := io.ReadAll(r.Body)
43-
require.NoError(t, err)
44+
assert.NoError(t, err)
4445

4546
var request *Request
46-
require.NoError(t, json.Unmarshal(b, &request))
47+
assert.NoError(t, json.Unmarshal(b, &request))
4748

48-
require.Equal(t, request.Data.UserID, who)
49-
require.Equal(t, "0009input", string(request.Output))
49+
assert.Equal(t, request.Data.UserID, who)
50+
assert.Equal(t, "0009input", string(request.Output))
5051

5152
err = json.NewEncoder(w).Encode(Response{Result: []byte("output")})
52-
require.NoError(t, err)
53+
assert.NoError(t, err)
5354
},
5455
},
5556
}
@@ -82,7 +83,7 @@ func TestExecuteEOFSent(t *testing.T) {
8283

8384
// expect printing of info message, "custom" string from the first request
8485
// and "output" string from the second request
85-
require.Equal(t, "customoutput", outBuf.String())
86+
assert.Equal(t, "customoutput", outBuf.String())
8687
}
8788

8889
func TestExecuteNoEOFSent(t *testing.T) {
@@ -93,32 +94,32 @@ func TestExecuteNoEOFSent(t *testing.T) {
9394
Path: "/geo/proxy/info_refs_upload_pack",
9495
Handler: func(w http.ResponseWriter, r *http.Request) {
9596
b, err := io.ReadAll(r.Body)
96-
require.NoError(t, err)
97+
assert.NoError(t, err)
9798

9899
var request *Request
99-
require.NoError(t, json.Unmarshal(b, &request))
100+
assert.NoError(t, json.Unmarshal(b, &request))
100101

101-
require.Equal(t, request.Data.UserID, who)
102-
require.Empty(t, request.Output)
102+
assert.Equal(t, request.Data.UserID, who)
103+
assert.Empty(t, request.Output)
103104

104105
err = json.NewEncoder(w).Encode(Response{Result: []byte("custom")})
105-
require.NoError(t, err)
106+
assert.NoError(t, err)
106107
},
107108
},
108109
{
109110
Path: "/geo/proxy/upload_pack",
110111
Handler: func(w http.ResponseWriter, r *http.Request) {
111112
b, err := io.ReadAll(r.Body)
112-
require.NoError(t, err)
113+
assert.NoError(t, err)
113114

114115
var request *Request
115-
require.NoError(t, json.Unmarshal(b, &request))
116+
assert.NoError(t, json.Unmarshal(b, &request))
116117

117-
require.Equal(t, request.Data.UserID, who)
118-
require.Equal(t, "0032want 343d70886785dc1f98aaf70f3b4ca87c93a5d0dd\n", string(request.Output))
118+
assert.Equal(t, request.Data.UserID, who)
119+
assert.Equal(t, "0032want 343d70886785dc1f98aaf70f3b4ca87c93a5d0dd\n", string(request.Output))
119120

120121
err = json.NewEncoder(w).Encode(Response{Result: []byte("output")})
121-
require.NoError(t, err)
122+
assert.NoError(t, err)
122123
},
123124
},
124125
}
@@ -151,5 +152,5 @@ func TestExecuteNoEOFSent(t *testing.T) {
151152

152153
// expect printing of info message, "custom" string from the first request
153154
// and "output" string from the second request
154-
require.Equal(t, "customoutput", outBuf.String())
155+
assert.Equal(t, "customoutput", outBuf.String())
155156
}

support/lint_last_known_acceptable.txt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -173,26 +173,6 @@ internal/command/readwriter/readwriter.go:7:6: exported: exported type ReadWrite
173173
internal/command/receivepack/gitalycall_test.go:24:4: S1038: should use t.Logf(...) instead of t.Log(fmt.Sprintf(...)) (gosimple)
174174
internal/command/receivepack/gitalycall_test.go:31:5: var-naming: struct field keyId should be keyID (revive)
175175
internal/command/receivepack/gitalycall_test.go:98:5: expected-actual: need to reverse actual and expected values (testifylint)
176-
internal/command/shared/customaction/customaction_test.go:27:5: go-require: do not use require in http handlers (testifylint)
177-
internal/command/shared/customaction/customaction_test.go:30:5: go-require: do not use require in http handlers (testifylint)
178-
internal/command/shared/customaction/customaction_test.go:32:5: go-require: do not use require in http handlers (testifylint)
179-
internal/command/shared/customaction/customaction_test.go:33:5: go-require: do not use require in http handlers (testifylint)
180-
internal/command/shared/customaction/customaction_test.go:36:5: go-require: do not use require in http handlers (testifylint)
181-
internal/command/shared/customaction/customaction_test.go:43:5: go-require: do not use require in http handlers (testifylint)
182-
internal/command/shared/customaction/customaction_test.go:46:5: go-require: do not use require in http handlers (testifylint)
183-
internal/command/shared/customaction/customaction_test.go:48:5: go-require: do not use require in http handlers (testifylint)
184-
internal/command/shared/customaction/customaction_test.go:49:5: go-require: do not use require in http handlers (testifylint)
185-
internal/command/shared/customaction/customaction_test.go:52:5: go-require: do not use require in http handlers (testifylint)
186-
internal/command/shared/customaction/customaction_test.go:96:5: go-require: do not use require in http handlers (testifylint)
187-
internal/command/shared/customaction/customaction_test.go:99:5: go-require: do not use require in http handlers (testifylint)
188-
internal/command/shared/customaction/customaction_test.go:101:5: go-require: do not use require in http handlers (testifylint)
189-
internal/command/shared/customaction/customaction_test.go:102:5: go-require: do not use require in http handlers (testifylint)
190-
internal/command/shared/customaction/customaction_test.go:105:5: go-require: do not use require in http handlers (testifylint)
191-
internal/command/shared/customaction/customaction_test.go:112:5: go-require: do not use require in http handlers (testifylint)
192-
internal/command/shared/customaction/customaction_test.go:115:5: go-require: do not use require in http handlers (testifylint)
193-
internal/command/shared/customaction/customaction_test.go:117:5: go-require: do not use require in http handlers (testifylint)
194-
internal/command/shared/customaction/customaction_test.go:118:5: go-require: do not use require in http handlers (testifylint)
195-
internal/command/shared/customaction/customaction_test.go:121:5: go-require: do not use require in http handlers (testifylint)
196176
internal/config/config.go:1:1: package-comments: should have a package comment (revive)
197177
internal/config/config.go:21:2: G101: Potential hardcoded credentials (gosec)
198178
internal/config/config.go:24:6: exported: exported type YamlDuration should have comment or be unexported (revive)

0 commit comments

Comments
 (0)