Skip to content

Commit

Permalink
Fix gossip tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lebdron committed May 4, 2024
1 parent 63cead0 commit b5e872e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions network/p2p/gossip/gossip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ func TestGossiperGossip(t *testing.T) {
txs: make(map[ids.ID]*testTx),
bloom: responseBloom,
}
for _, item := range tt.responder {
require.NoError(responseSet.Add(item))
errs := responseSet.Add(tt.responder...)
for _, err := range errs {
require.NoError(err)
}

metrics, err := NewMetrics(prometheus.NewRegistry(), "")
Expand Down Expand Up @@ -147,8 +148,9 @@ func TestGossiperGossip(t *testing.T) {
txs: make(map[ids.ID]*testTx),
bloom: bloom,
}
for _, item := range tt.requester {
require.NoError(requestSet.Add(item))
errs = responseSet.Add(tt.responder...)
for _, err := range errs {
require.NoError(err)
}

requestClient := requestNetwork.NewClient(0x0)
Expand Down
2 changes: 1 addition & 1 deletion vms/avm/network/gossip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func TestGossipMempoolAdd(t *testing.T) {
TxID: ids.GenerateTestID(),
}

require.NoError(mempool.Add(tx))
require.NoError(mempool.Add(tx)[0])
require.True(mempool.bloom.Has(tx))
}

Expand Down
8 changes: 4 additions & 4 deletions vms/platformvm/network/gossip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestGossipMempoolAddVerificationError(t *testing.T) {
)
require.NoError(err)

err = gossipMempool.Add(tx)
err = gossipMempool.Add(tx)[0]
require.ErrorIs(err, errFoo)
require.False(gossipMempool.bloom.Has(tx))
}
Expand Down Expand Up @@ -81,7 +81,7 @@ func TestGossipMempoolAddError(t *testing.T) {
)
require.NoError(err)

err = gossipMempool.Add(tx)
err = gossipMempool.Add(tx)[0]
require.ErrorIs(err, errFoo)
require.False(gossipMempool.bloom.Has(tx))
}
Expand Down Expand Up @@ -112,7 +112,7 @@ func TestMempoolDuplicate(t *testing.T) {
)
require.NoError(err)

err = gossipMempool.Add(tx)
err = gossipMempool.Add(tx)[0]
require.ErrorIs(err, mempool.ErrDuplicateTx)
require.False(gossipMempool.bloom.Has(tx))
}
Expand Down Expand Up @@ -147,6 +147,6 @@ func TestGossipAddBloomFilter(t *testing.T) {
)
require.NoError(err)

require.NoError(gossipMempool.Add(tx))
require.NoError(gossipMempool.Add(tx)[0])
require.True(gossipMempool.bloom.Has(tx))
}

0 comments on commit b5e872e

Please sign in to comment.