Skip to content

Commit 833dea2

Browse files
authored
Reenable testifylint (#2770)
1 parent 39a8f04 commit 833dea2

File tree

9 files changed

+17
-10
lines changed

9 files changed

+17
-10
lines changed

.golangci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ linters:
3838
- "spancheck"
3939
- "staticcheck"
4040
- "tagalign"
41-
# - "testifylint" TODO: fix issues
41+
- "testifylint"
4242
- "tparallel"
4343
- "unconvert"
4444
- "usetesting"

cmd/spicedb/integration/schemawatch_integration_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/google/uuid"
1212
"github.com/ory/dockertest/v3"
1313
"github.com/ory/dockertest/v3/docker"
14+
"github.com/stretchr/testify/assert"
1415
"github.com/stretchr/testify/require"
1516

1617
testdatastore "github.com/authzed/spicedb/internal/testserver/datastore"
@@ -109,7 +110,7 @@ func TestSchemaWatch(t *testing.T) {
109110

110111
go (func() {
111112
err = pool.Client.Logs(opts)
112-
require.NoError(t, err)
113+
assert.NoError(t, err)
113114
})()
114115

115116
select {

cmd/spicedb/integration/serve_integration_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/google/uuid"
1313
"github.com/ory/dockertest/v3"
1414
"github.com/ory/dockertest/v3/docker"
15+
"github.com/stretchr/testify/assert"
1516
"github.com/stretchr/testify/require"
1617
"google.golang.org/grpc"
1718
"google.golang.org/grpc/codes"
@@ -238,7 +239,7 @@ func TestGracefulShutdown(t *testing.T) {
238239

239240
go (func() {
240241
err = pool.Client.Logs(opts)
241-
require.NoError(t, err)
242+
assert.NoError(t, err)
242243
})()
243244

244245
select {

internal/datastore/proxy/counting_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"sync"
66
"testing"
77

8+
"github.com/stretchr/testify/assert"
89
"github.com/stretchr/testify/mock"
910
"github.com/stretchr/testify/require"
1011

@@ -175,7 +176,7 @@ func TestCountingProxyThreadSafety(t *testing.T) {
175176
r := ds.SnapshotReader(datastore.NoRevision)
176177
for range callsPerGoroutine {
177178
_, err := r.QueryRelationships(ctx, datastore.RelationshipsFilter{})
178-
require.NoError(err)
179+
assert.NoError(t, err)
179180
}
180181
}()
181182
}

internal/dispatch/caching/cachingdispatch_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"time"
88

99
"github.com/shopspring/decimal"
10+
"github.com/stretchr/testify/assert"
1011
"github.com/stretchr/testify/mock"
1112
"github.com/stretchr/testify/require"
1213

@@ -206,7 +207,7 @@ func TestConcurrentDebugInfoAccess(t *testing.T) {
206207
return
207208
}
208209

209-
require.NotNil(resp.GetMetadata().GetDebugInfo().GetCheck().GetRequest())
210+
assert.NotNil(t, resp.GetMetadata().GetDebugInfo().GetCheck().GetRequest())
210211

211212
// we mutate the response to prove that it's not shared across goroutines
212213
resp.GetMetadata().GetDebugInfo().GetCheck().GetRequest().Subject.Relation = "modified"

internal/dispatch/singleflight/singleflight_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/bits-and-blooms/bloom/v3"
1212
"github.com/prometheus/client_golang/prometheus"
1313
promclient "github.com/prometheus/client_model/go"
14+
"github.com/stretchr/testify/assert"
1415
"github.com/stretchr/testify/require"
1516

1617
"github.com/authzed/spicedb/internal/dispatch"
@@ -43,7 +44,7 @@ func TestSingleFlightDispatcher(t *testing.T) {
4344
wg.Add(4)
4445
go func() {
4546
resp1, err := disp.DispatchCheck(t.Context(), req.CloneVT())
46-
require.NoError(t, err)
47+
assert.NoError(t, err)
4748
// this goroutine mutates the response; other goroutines that read should be unaffected
4849
resp1.GetMetadata().GetDebugInfo().GetCheck().GetSubProblems()[0].IsCachedResult = false
4950
wg.Done()

internal/services/integrationtesting/perf_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"testing"
1010
"time"
1111

12+
"github.com/stretchr/testify/assert"
1213
"github.com/stretchr/testify/require"
1314

1415
v1 "github.com/authzed/authzed-go/proto/authzed/api/v1"
@@ -66,7 +67,7 @@ func TestBurst(t *testing.T) {
6667
Permission: "viewer",
6768
Subject: rel.Subject,
6869
})
69-
require.NoError(t, err)
70+
assert.NoError(t, err)
7071
}()
7172
run <- struct{}{}
7273
}

pkg/cmd/server/server_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"testing"
77
"time"
88

9+
"github.com/stretchr/testify/assert"
910
"github.com/stretchr/testify/require"
1011
"go.opentelemetry.io/otel"
1112
"go.opentelemetry.io/otel/sdk/trace"
@@ -191,7 +192,7 @@ func TestDisableHealthCheckTracing(t *testing.T) {
191192
defer conn.Close()
192193

193194
go func() {
194-
require.NoError(t, srv.Run(ctx))
195+
assert.NoError(t, srv.Run(ctx))
195196
}()
196197

197198
// Poll for gRPC server readiness instead of sleeping

pkg/schema/v2/convert_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ func TestMetadataPreservation(t *testing.T) {
885885
defs, caveats, err := schema.ToDefinitions()
886886
require.NoError(t, err)
887887
require.Len(t, defs, 1)
888-
require.Len(t, caveats, 0)
888+
require.Empty(t, caveats)
889889

890890
// Verify metadata is preserved
891891
require.NotNil(t, defs[0].Metadata, "Metadata should be preserved during round-trip conversion")
@@ -936,7 +936,7 @@ func TestMetadataPreservation(t *testing.T) {
936936
// Convert back to corev1
937937
defs, caveats, err := schema.ToDefinitions()
938938
require.NoError(t, err)
939-
require.Len(t, defs, 0)
939+
require.Empty(t, defs)
940940
require.Len(t, caveats, 1)
941941

942942
// Verify metadata is preserved

0 commit comments

Comments
 (0)