Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ output:
linters:
default: none
enable:
- errcheck
- forbidigo
- gosec
- govet
Expand Down
27 changes: 14 additions & 13 deletions internal/api/v1beta1connect/authenticate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

func TestConnectHandler_AuthToken_ServiceUser(t *testing.T) {
Expand Down Expand Up @@ -176,9 +177,9 @@ func TestConnectHandler_GetJWKs(t *testing.T) {
// Create a test key set
testKeySet := jwk.NewSet()
testKey, _ := jwk.FromRaw([]byte("test-key-data"))
testKey.Set(jwk.KeyIDKey, "test-key-id")
testKey.Set(jwk.KeyTypeKey, "oct")
testKeySet.AddKey(testKey)
_ = testKey.Set(jwk.KeyIDKey, "test-key-id")
_ = testKey.Set(jwk.KeyTypeKey, "oct")
_ = testKeySet.AddKey(testKey)

authn.EXPECT().JWKs(mock.Anything).Return(testKeySet)
},
Expand Down Expand Up @@ -214,15 +215,15 @@ func TestConnectHandler_GetJWKs(t *testing.T) {

// First key
testKey1, _ := jwk.FromRaw([]byte("test-key-data-1"))
testKey1.Set(jwk.KeyIDKey, "test-key-id-1")
testKey1.Set(jwk.KeyTypeKey, "oct")
testKeySet.AddKey(testKey1)
_ = testKey1.Set(jwk.KeyIDKey, "test-key-id-1")
_ = testKey1.Set(jwk.KeyTypeKey, "oct")
_ = testKeySet.AddKey(testKey1)

// Second key
testKey2, _ := jwk.FromRaw([]byte("test-key-data-2"))
testKey2.Set(jwk.KeyIDKey, "test-key-id-2")
testKey2.Set(jwk.KeyTypeKey, "oct")
testKeySet.AddKey(testKey2)
_ = testKey2.Set(jwk.KeyIDKey, "test-key-id-2")
_ = testKey2.Set(jwk.KeyTypeKey, "oct")
_ = testKeySet.AddKey(testKey2)

authn.EXPECT().JWKs(mock.Anything).Return(testKeySet)
},
Expand Down Expand Up @@ -297,9 +298,9 @@ func TestToJSONWebKey(t *testing.T) {
keySet: func() jwk.Set {
keySet := jwk.NewSet()
testKey, _ := jwk.FromRaw([]byte("test-key-data"))
testKey.Set(jwk.KeyIDKey, "test-key-id")
testKey.Set(jwk.KeyTypeKey, "oct")
keySet.AddKey(testKey)
_ = testKey.Set(jwk.KeyIDKey, "test-key-id")
_ = testKey.Set(jwk.KeyTypeKey, "oct")
_ = keySet.AddKey(testKey)
return keySet
}(),
expectError: false,
Expand All @@ -326,7 +327,7 @@ func TestToJSONWebKey(t *testing.T) {
// Verify the structure is correct
keySetJson, _ := json.Marshal(tt.keySet)
var expectedJWKS JsonWebKeySet
json.Unmarshal(keySetJson, &expectedJWKS)
require.NoError(t, json.Unmarshal(keySetJson, &expectedJWKS))
assert.Equal(t, len(expectedJWKS.Keys), len(result.Keys))
}
})
Expand Down
2 changes: 1 addition & 1 deletion internal/store/postgres/prospect_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ func (s *ProspectRepositoryTestSuite) TestDelete() {
for _, tc := range testCases {
s.Run(tc.Description, func() {
// Reset the test data for each test case
s.cleanup()
s.Require().NoError(s.cleanup())
s.SetupTest()

if tc.SetupFn != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/server/webhook_bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type mockHandler struct {

func (m *mockHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(m.statusCode)
w.Write(m.response)
_, _ = w.Write(m.response)
}

func TestWebhookBridgeHandler_HTTPMethods(t *testing.T) {
Expand Down Expand Up @@ -158,7 +158,7 @@ func TestWebhookBridgeHandler_SuccessfulRequest(t *testing.T) {
// Return success
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Write([]byte(`{}`))
_, _ = w.Write([]byte(`{}`))
})

req := httptest.NewRequest("POST", "/billing/webhooks/callback/stripe", bytes.NewReader([]byte(`{"event":"test"}`)))
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/regression/authentication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func (s *AuthenticationRegressionTestSuite) TestUserSession() {
Handler: callbackMux,
}
// clean up callback server
defer srv.Shutdown(ctx)
defer srv.Shutdown(ctx) // nolint
go func() {
if err := srv.ListenAndServe(); err != http.ErrServerClosed {
s.Assert().NoError(err)
Expand Down
Loading