fixup unused functions/vars

This commit is contained in:
Evan Jarrett
2026-01-04 21:16:02 -06:00
parent 680e4bdfe2
commit fbcaf56fce
7 changed files with 5 additions and 45 deletions

View File

@@ -20,6 +20,11 @@ linters:
exclusions:
presets:
- std-error-handling
rules:
- path: _test\.go
linters:
- errcheck
formatters:
enable:
- gofmt

View File

@@ -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)

View File

@@ -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{

View File

@@ -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) {

View File

@@ -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

View File

@@ -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

View File

@@ -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
}