Skip to content

Commit daf182d

Browse files
committed
feat: remove gotest.tools
1 parent 445b277 commit daf182d

File tree

7 files changed

+20
-24
lines changed

7 files changed

+20
-24
lines changed

client/sbp_upgrade_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,31 @@ import (
55
"strconv"
66
"testing"
77

8-
"gotest.tools/assert"
8+
"github.com/stretchr/testify/assert"
99

1010
"github.com/vitelabs/go-vite/v2/common/types"
1111
)
1212

1313
func TestSBPUpgrade(t *testing.T) {
1414
rpc, err := NewRpcClient(RawUrl)
15-
assert.NilError(t, err)
15+
assert.NoError(t, err)
1616

1717
sbpMap := make(map[types.Address]string)
1818
versionMap := make(map[string]uint32)
1919

2020
sbpList, err := rpc.GetSBPVoteList()
21-
assert.NilError(t, err)
21+
assert.NoError(t, err)
2222

2323
for _, sbp := range sbpList {
2424
fmt.Println(sbp.Name, sbp.BlockProducingAddress)
2525
sbpMap[sbp.BlockProducingAddress] = sbp.Name
2626
}
2727

2828
latestHeight, err := strconv.ParseUint(rpc.GetSnapshotChainHeight(), 10, 64)
29-
assert.NilError(t, err)
29+
assert.NoError(t, err)
3030

3131
blocks, err := rpc.GetSnapshotBlocks(latestHeight, 500)
32-
assert.NilError(t, err)
32+
assert.NoError(t, err)
3333

3434
for _, block := range blocks {
3535
producer := block.Producer

go.mod

-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,4 @@ require (
3636
gopkg.in/natefinch/lumberjack.v2 v2.0.0
3737
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce
3838
gopkg.in/urfave/cli.v1 v1.20.0
39-
gotest.tools v2.2.0+incompatible
4039
)

go.sum

-2
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,3 @@ gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
184184
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
185185
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
186186
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
187-
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
188-
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=

ledger/chain/block/block_db_test.go

+12-13
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import (
55
"path"
66
"testing"
77

8-
"gotest.tools/assert"
9-
8+
"github.com/stretchr/testify/assert"
109
"github.com/vitelabs/go-vite/v2/common"
1110
"github.com/vitelabs/go-vite/v2/crypto"
1211
chain_file_manager "github.com/vitelabs/go-vite/v2/ledger/chain/file_manager"
@@ -15,7 +14,7 @@ import (
1514
func TestReadSnapshotBlocks(t *testing.T) {
1615
chainDir := path.Join(common.HomeDir(), ".gvite/mockdata/ledger_2101_2")
1716
db, err := NewBlockDB(chainDir)
18-
assert.NilError(t, err)
17+
assert.NoError(t, err)
1918
statusList := db.GetStatus()
2019
for _, status := range statusList {
2120
t.Log(status.Name, status.Count, status.Size, status.Status)
@@ -29,7 +28,7 @@ func TestReadSnapshotBlocks(t *testing.T) {
2928
if err == io.EOF {
3029
break
3130
}
32-
assert.NilError(t, err)
31+
assert.NoError(t, err)
3332
if nextLocation == nil {
3433
break
3534
}
@@ -45,7 +44,7 @@ func TestReadSnapshotBlocks(t *testing.T) {
4544
func TestReadAccountBlocks(t *testing.T) {
4645
chainDir := path.Join(common.HomeDir(), ".gvite/mockdata/ledger_2101_2")
4746
db, err := NewBlockDB(chainDir)
48-
assert.NilError(t, err)
47+
assert.NoError(t, err)
4948
statusList := db.GetStatus()
5049
for _, status := range statusList {
5150
t.Log(status.Name, status.Count, status.Size, status.Status)
@@ -59,7 +58,7 @@ func TestReadAccountBlocks(t *testing.T) {
5958
if err == io.EOF {
6059
break
6160
}
62-
assert.NilError(t, err)
61+
assert.NoError(t, err)
6362
if nextLocation == nil {
6463
break
6564
}
@@ -74,7 +73,7 @@ func TestReadAccountBlocks(t *testing.T) {
7473
func TestReadLocation(t *testing.T) {
7574
chainDir := path.Join(common.HomeDir(), ".gvite/mockdata/ledger_2101_1")
7675
db, err := NewBlockDB(chainDir)
77-
assert.NilError(t, err)
76+
assert.NoError(t, err)
7877
statusList := db.GetStatus()
7978
for _, status := range statusList {
8079
t.Log(status.Name, status.Count, status.Size, status.Status)
@@ -88,33 +87,33 @@ func TestDiffBlocksDB(t *testing.T) {
8887
chainDirA := path.Join(common.HomeDir(), ".gvite/mockdata/ledger_2101_1")
8988
chainDirB := path.Join(common.HomeDir(), ".gvite/mockdata/ledger_2101_2")
9089
dbA, err := NewBlockDB(chainDirA)
91-
assert.NilError(t, err)
90+
assert.NoError(t, err)
9291
dbB, err := NewBlockDB(chainDirB)
93-
assert.NilError(t, err)
92+
assert.NoError(t, err)
9493

9594
location := chain_file_manager.NewLocation(1, 7333187)
9695
//printLocationContext(t, location, dbA)
9796
//printLocationContext(t, location, dbB)
9897

9998
for {
10099
bytA, nextLocationA, err := dbA.ReadUnitBytes(location)
101-
assert.NilError(t, err)
100+
assert.NoError(t, err)
102101
bytB, nextLocationB, err := dbB.ReadUnitBytes(location)
103-
assert.NilError(t, err)
102+
assert.NoError(t, err)
104103

105104
t.Log(location.FileId, location.Offset)
106105
assert.Equal(t, nextLocationA.FileId, nextLocationB.FileId, nextLocationA.String(), nextLocationB.String(), location.String())
107106
assert.Equal(t, nextLocationA.Offset, nextLocationB.Offset, nextLocationA.String(), nextLocationB.String(), location.String())
108107
assert.Equal(t, len(bytA), len(bytB))
109-
assert.DeepEqual(t, crypto.Hash256(bytA), crypto.Hash256(bytB))
108+
assert.EqualValues(t, crypto.Hash256(bytA), crypto.Hash256(bytB))
110109

111110
location = nextLocationA
112111
}
113112
}
114113

115114
func printLocationContext(t *testing.T, location *chain_file_manager.Location, db *BlockDB) {
116115
sb, ab, nextLocation, err := db.ReadUnit(location)
117-
assert.NilError(t, err)
116+
assert.NoError(t, err)
118117
if sb != nil {
119118
t.Log("snapshot block", sb.Height, sb.Hash)
120119
}

ledger/pipeline/pipeline_blocks_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"testing"
55
"time"
66

7-
"gotest.tools/assert"
7+
"github.com/stretchr/testify/assert"
88
)
99

1010
func TestPipeline(t *testing.T) {

tools/toposort/topsort_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"sort"
55
"testing"
66

7-
"gotest.tools/assert"
7+
"github.com/stretchr/testify/assert"
88
)
99

1010
type items struct {

wallet/account_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package wallet
33
import (
44
"testing"
55

6-
"gotest.tools/assert"
6+
"github.com/stretchr/testify/assert"
77
)
88

99
func TestAccount(t *testing.T) {

0 commit comments

Comments
 (0)