diff --git a/.golangci.yml b/.golangci.yml index 43e25c0..6a879dd 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -20,6 +20,11 @@ linters: exclusions: presets: - std-error-handling + rules: + - path: _test\.go + linters: + - errcheck + formatters: enable: - gofmt diff --git a/pkg/appview/middleware/registry_test.go b/pkg/appview/middleware/registry_test.go index 2c3d0a0..f9e13c3 100644 --- a/pkg/appview/middleware/registry_test.go +++ b/pkg/appview/middleware/registry_test.go @@ -45,12 +45,6 @@ func (m *mockNamespace) BlobStatter() distribution.BlobStatter { return nil } -// mockRepository is a minimal mock implementation -type mockRepository struct { - distribution.Repository - name string -} - func TestSetGlobalRefresher(t *testing.T) { // Test that SetGlobalRefresher doesn't panic SetGlobalRefresher(nil) diff --git a/pkg/appview/storage/context_test.go b/pkg/appview/storage/context_test.go index c26b0f1..fda5582 100644 --- a/pkg/appview/storage/context_test.go +++ b/pkg/appview/storage/context_test.go @@ -17,12 +17,6 @@ func (m *mockHoldDIDLookup) GetLatestHoldDIDForRepo(did, repository string) (str return m.holdDID, nil } -type mockHoldAuthorizer struct{} - -func (m *mockHoldAuthorizer) Authorize(holdDID, userDID, permission string) (bool, error) { - return true, nil -} - func TestRegistryContext_Fields(t *testing.T) { // Create a sample RegistryContext ctx := &RegistryContext{ diff --git a/pkg/auth/oauth/server_test.go b/pkg/auth/oauth/server_test.go index 4b3aecf..6e7bcac 100644 --- a/pkg/auth/oauth/server_test.go +++ b/pkg/auth/oauth/server_test.go @@ -115,16 +115,6 @@ func (m *mockUISessionStore) DeleteByDID(did string) { } } -type mockRefresher struct { - invalidateSessionFunc func(did string) -} - -func (m *mockRefresher) InvalidateSession(did string) { - if m.invalidateSessionFunc != nil { - m.invalidateSessionFunc(did) - } -} - // ServeAuthorize tests func TestServer_ServeAuthorize_MissingHandle(t *testing.T) { diff --git a/pkg/auth/token/handler_test.go b/pkg/auth/token/handler_test.go index 3f44547..da5ea1e 100644 --- a/pkg/auth/token/handler_test.go +++ b/pkg/auth/token/handler_test.go @@ -2,7 +2,6 @@ package token import ( "context" - "crypto/rsa" "crypto/tls" "database/sql" "encoding/base64" @@ -22,7 +21,6 @@ import ( // Shared test key to avoid generating a new RSA key for each test // Generating a 2048-bit RSA key takes ~0.15s, so reusing one key saves ~4.5s for 32 tests var ( - sharedTestKey *rsa.PrivateKey sharedTestKeyPath string sharedTestKeyOnce sync.Once sharedTestKeyDir string diff --git a/pkg/auth/token/issuer_test.go b/pkg/auth/token/issuer_test.go index f0a3dcb..31bb200 100644 --- a/pkg/auth/token/issuer_test.go +++ b/pkg/auth/token/issuer_test.go @@ -19,7 +19,6 @@ import ( // Shared test key to avoid generating a new RSA key for each test // Generating a 2048-bit RSA key takes ~0.15s, so reusing one key saves significant time var ( - issuerSharedTestKey *rsa.PrivateKey issuerSharedTestKeyPath string issuerSharedTestKeyOnce sync.Once issuerSharedTestKeyDir string diff --git a/pkg/hold/pds/records_test.go b/pkg/hold/pds/records_test.go index 469838f..db1e4ac 100644 --- a/pkg/hold/pds/records_test.go +++ b/pkg/hold/pds/records_test.go @@ -1,12 +1,10 @@ package pds import ( - "context" "os" "path/filepath" "testing" - "github.com/bluesky-social/indigo/repo" _ "github.com/mattn/go-sqlite3" ) @@ -607,21 +605,3 @@ func TestRecordsIndex_MultipleCollections(t *testing.T) { t.Errorf("Expected captain count 1 after deleting crew, got %d", count) } } - -// mockRepo is a minimal mock for testing backfill -// Note: Full backfill testing requires integration tests with real repo -type mockRepo struct { - records map[string]string // key -> cid -} - -func (m *mockRepo) ForEach(ctx context.Context, prefix string, fn func(string, any) error) error { - for k, v := range m.records { - if err := fn(k, v); err != nil { - if err == repo.ErrDoneIterating { - return nil - } - return err - } - } - return nil -}