Skip to content

Commit

Permalink
Fix GolangCI-Lint warnings (#412)
Browse files Browse the repository at this point in the history
  • Loading branch information
developerkunal authored Jun 5, 2024
1 parent ec52c3e commit 8be5f5d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion authentication/authentication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,9 @@ func TestWithClockTolerance(t *testing.T) {
return
}
w.WriteHeader(http.StatusOK)
fmt.Fprint(w, string(b))
if _, err := fmt.Fprint(w, string(b)); err != nil {
w.WriteHeader(http.StatusInternalServerError)
}
})
s := httptest.NewTLSServer(h)
t.Cleanup(func() {
Expand Down
4 changes: 3 additions & 1 deletion authentication/oauth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,9 @@ func withIDToken(t *testing.T, extras map[string]interface{}) (*Authentication,
return
}
w.WriteHeader(http.StatusOK)
fmt.Fprint(w, string(b))
if _, err := fmt.Fprint(w, string(b)); err != nil {
w.WriteHeader(http.StatusInternalServerError)
}
})
s := httptest.NewTLSServer(h)
t.Cleanup(func() {
Expand Down
8 changes: 5 additions & 3 deletions internal/idtokenvalidator/idtokenvalidator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ func TestIDTokenValidation(t *testing.T) {
token, err := builder.Build()
assert.NoError(t, err)

jwt, err := jwt.Sign(token, jwt.WithKey(jwa.HS512, []byte(jwtClientSecret)))
jwtPayload, err := jwt.Sign(token, jwt.WithKey(jwa.HS512, []byte(jwtClientSecret)))
assert.NoError(t, err)

validator, err := New(context.Background(), jwtDomain, jwtClientSecret, jwtClientID, "HS256")
assert.NoError(t, err)

err = validator.Validate(string(jwt), ValidationOptions{})
err = validator.Validate(string(jwtPayload), ValidationOptions{})
assert.ErrorContains(t, err, "signature algorithm \"HS512\" is not supported")
})

Expand Down Expand Up @@ -650,7 +650,9 @@ func configureSigning(t *testing.T, args jwtArgs) (jwa.SignatureAlgorithm, jwk.K
return
}
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, `{"keys": [%s] }`, b)
if _, err := fmt.Fprintf(w, `{"keys": [%s] }`, b); err != nil {
w.WriteHeader(http.StatusInternalServerError)
}
})
s := httptest.NewTLSServer(h)

Expand Down

0 comments on commit 8be5f5d

Please sign in to comment.