As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Commit 13f3194f authored by Archish's avatar Archish
Browse files

Lint fixes in accessverifier package

parent cffe8fc0
No related branches found
No related tags found
No related merge requests found
// Package accessverifier handles the verification of access permission.
package accessverifier
import (
Loading
Loading
@@ -11,14 +12,17 @@ import (
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/gitlabnet/accessverifier"
)
// Response is an alias for accessverifier.Response, representing the result of an access verification.
type Response = accessverifier.Response
// Command handles access verification commands.
type Command struct {
Config *config.Config
Args *commandargs.Shell
ReadWriter *readwriter.ReadWriter
}
// Verify checks access permissions and returns a response.
func (c *Command) Verify(ctx context.Context, action commandargs.CommandType, repo string) (*Response, error) {
client, err := accessverifier.NewClient(c.Config)
if err != nil {
Loading
Loading
Loading
Loading
@@ -8,6 +8,7 @@ import (
"net/http"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver"
Loading
Loading
@@ -28,23 +29,23 @@ func setup(t *testing.T) (*Command, *bytes.Buffer, *bytes.Buffer) {
Path: "/api/v4/internal/allowed",
Handler: func(w http.ResponseWriter, r *http.Request) {
b, err := io.ReadAll(r.Body)
require.NoError(t, err)
assert.NoError(t, err)
var requestBody *accessverifier.Request
err = json.Unmarshal(b, &requestBody)
require.NoError(t, err)
assert.NoError(t, err)
if requestBody.KeyID == "1" {
body := map[string]interface{}{
"gl_console_messages": []string{"console", "message"},
}
require.NoError(t, json.NewEncoder(w).Encode(body))
assert.NoError(t, json.NewEncoder(w).Encode(body))
} else {
body := map[string]interface{}{
"status": false,
"message": "missing user",
}
require.NoError(t, json.NewEncoder(w).Encode(body))
assert.NoError(t, json.NewEncoder(w).Encode(body))
}
},
},
Loading
Loading
Loading
Loading
@@ -208,14 +208,6 @@ internal/command/readwriter/readwriter.go:7:6: exported: exported type ReadWrite
internal/command/receivepack/gitalycall_test.go:24:4: S1038: should use t.Logf(...) instead of t.Log(fmt.Sprintf(...)) (gosimple)
internal/command/receivepack/gitalycall_test.go:31:5: var-naming: struct field keyId should be keyID (revive)
internal/command/receivepack/gitalycall_test.go:98:5: expected-actual: need to reverse actual and expected values (testifylint)
internal/command/shared/accessverifier/accessverifier.go:1:1: package-comments: should have a package comment (revive)
internal/command/shared/accessverifier/accessverifier.go:14:6: exported: exported type Response should have comment or be unexported (revive)
internal/command/shared/accessverifier/accessverifier.go:16:6: exported: exported type Command should have comment or be unexported (revive)
internal/command/shared/accessverifier/accessverifier.go:22:1: exported: exported method Command.Verify should have comment or be unexported (revive)
internal/command/shared/accessverifier/accessverifier_test.go:31:5: go-require: do not use require in http handlers (testifylint)
internal/command/shared/accessverifier/accessverifier_test.go:35:5: go-require: do not use require in http handlers (testifylint)
internal/command/shared/accessverifier/accessverifier_test.go:41:6: go-require: do not use require in http handlers (testifylint)
internal/command/shared/accessverifier/accessverifier_test.go:47:6: go-require: do not use require in http handlers (testifylint)
internal/command/shared/customaction/customaction_test.go:27:5: go-require: do not use require in http handlers (testifylint)
internal/command/shared/customaction/customaction_test.go:30:5: go-require: do not use require in http handlers (testifylint)
internal/command/shared/customaction/customaction_test.go:32:5: go-require: do not use require in http handlers (testifylint)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment