Skip to content

Commit 6b65a4c

Browse files
Vasilii IakliushinArchish27
authored andcommitted
Merge branch '790-customaction-lint' into 'main'
Lint fixes for customaction package Closes #790 See merge request https://gitlab.com/gitlab-org/gitlab-shell/-/merge_requests/1147 Merged-by: Vasilii Iakliushin <[email protected]> Approved-by: Vasilii Iakliushin <[email protected]> Reviewed-by: Vasilii Iakliushin <[email protected]> Co-authored-by: Archish <[email protected]>
2 parents 79f05d0 + a82047f commit 6b65a4c

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
@@ -148,26 +148,6 @@ internal/command/readwriter/readwriter.go:7:6: exported: exported type ReadWrite
148148
internal/command/receivepack/gitalycall_test.go:24:4: S1038: should use t.Logf(...) instead of t.Log(fmt.Sprintf(...)) (gosimple)
149149
internal/command/receivepack/gitalycall_test.go:31:5: var-naming: struct field keyId should be keyID (revive)
150150
internal/command/receivepack/gitalycall_test.go:98:5: expected-actual: need to reverse actual and expected values (testifylint)
151-
internal/command/shared/customaction/customaction_test.go:27:5: go-require: do not use require in http handlers (testifylint)
152-
internal/command/shared/customaction/customaction_test.go:30:5: go-require: do not use require in http handlers (testifylint)
153-
internal/command/shared/customaction/customaction_test.go:32:5: go-require: do not use require in http handlers (testifylint)
154-
internal/command/shared/customaction/customaction_test.go:33:5: go-require: do not use require in http handlers (testifylint)
155-
internal/command/shared/customaction/customaction_test.go:36:5: go-require: do not use require in http handlers (testifylint)
156-
internal/command/shared/customaction/customaction_test.go:43:5: go-require: do not use require in http handlers (testifylint)
157-
internal/command/shared/customaction/customaction_test.go:46:5: go-require: do not use require in http handlers (testifylint)
158-
internal/command/shared/customaction/customaction_test.go:48:5: go-require: do not use require in http handlers (testifylint)
159-
internal/command/shared/customaction/customaction_test.go:49:5: go-require: do not use require in http handlers (testifylint)
160-
internal/command/shared/customaction/customaction_test.go:52:5: go-require: do not use require in http handlers (testifylint)
161-
internal/command/shared/customaction/customaction_test.go:96:5: go-require: do not use require in http handlers (testifylint)
162-
internal/command/shared/customaction/customaction_test.go:99:5: go-require: do not use require in http handlers (testifylint)
163-
internal/command/shared/customaction/customaction_test.go:101:5: go-require: do not use require in http handlers (testifylint)
164-
internal/command/shared/customaction/customaction_test.go:102:5: go-require: do not use require in http handlers (testifylint)
165-
internal/command/shared/customaction/customaction_test.go:105:5: go-require: do not use require in http handlers (testifylint)
166-
internal/command/shared/customaction/customaction_test.go:112:5: go-require: do not use require in http handlers (testifylint)
167-
internal/command/shared/customaction/customaction_test.go:115:5: go-require: do not use require in http handlers (testifylint)
168-
internal/command/shared/customaction/customaction_test.go:117:5: go-require: do not use require in http handlers (testifylint)
169-
internal/command/shared/customaction/customaction_test.go:118:5: go-require: do not use require in http handlers (testifylint)
170-
internal/command/shared/customaction/customaction_test.go:121:5: go-require: do not use require in http handlers (testifylint)
171151
internal/config/config.go:1:1: package-comments: should have a package comment (revive)
172152
internal/config/config.go:21:2: G101: Potential hardcoded credentials (gosec)
173153
internal/config/config.go:24:6: exported: exported type YamlDuration should have comment or be unexported (revive)

0 commit comments

Comments
 (0)