Skip to content

Commit f0856ee

Browse files
committed
chore: enable testifylint
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent 64b4268 commit f0856ee

25 files changed

+1366
-2560
lines changed

.golangci.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ linters:
1010
- govet
1111
- ineffassign
1212
- staticcheck
13+
- testifylint
1314
- unused
1415
linters-settings: # please keep this alphabetized
1516
goimports:
1617
local-prefixes: go.etcd.io # Put imports beginning with prefix after 3rd-party packages.
18+
testifylint:
19+
disable:
20+
- go-require
21+
enable-all: true
22+
formatter:
23+
require-f-funcs: true

allocate_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ package bbolt
33
import (
44
"testing"
55

6+
"github.com/stretchr/testify/assert"
7+
"github.com/stretchr/testify/require"
8+
69
"go.etcd.io/bbolt/internal/common"
710
"go.etcd.io/bbolt/internal/freelist"
811
)
@@ -26,14 +29,11 @@ func TestTx_allocatePageStats(t *testing.T) {
2629
prePageCnt := txStats.GetPageCount()
2730
allocateCnt := f.FreeCount()
2831

29-
if _, err := tx.allocate(allocateCnt); err != nil {
30-
t.Fatal(err)
31-
}
32+
_, err := tx.allocate(allocateCnt)
33+
require.NoError(t, err)
3234

3335
txStats = tx.Stats()
34-
if txStats.GetPageCount() != prePageCnt+int64(allocateCnt) {
35-
t.Errorf("Allocated %d but got %d page in stats", allocateCnt, txStats.GetPageCount())
36-
}
36+
assert.Equalf(t, txStats.GetPageCount(), prePageCnt+int64(allocateCnt), "Allocated %d but got %d page in stats", allocateCnt, txStats.GetPageCount())
3737
})
3838
}
3939
}

0 commit comments

Comments
 (0)