fixed tests

This commit is contained in:
StephenButtolph 2020-06-06 12:23:54 -04:00
parent b6ab0891a3
commit aab9005d68
8 changed files with 47 additions and 10 deletions

View File

@ -58,7 +58,13 @@ func newConfig(t *testing.T) (BootstrapConfig, ids.ShortID, *common.SenderTest,
peerID := peer.ID()
peers.Add(peer)
handler.Initialize(engine, make(chan common.Message), 1)
handler.Initialize(
engine,
make(chan common.Message),
1,
"",
prometheus.NewRegistry(),
)
timeouts.Initialize(0)
router.Initialize(ctx.Log, timeouts, time.Hour, time.Second)

View File

@ -72,7 +72,7 @@ type maxHeightVertexHeap struct {
elementIDs ids.Set
}
func NewMaxVertexHeap() *maxHeightVertexHeap {
func newMaxVertexHeap() *maxHeightVertexHeap {
return &maxHeightVertexHeap{
heap: &priorityQueue{},
elementIDs: ids.Set{},

View File

@ -10,7 +10,7 @@ import (
// This example inserts several ints into an IntHeap, checks the minimum,
// and removes them in order of priority.
func TestUniqueVertexHeapReturnsOrdered(t *testing.T) {
h := NewMaxVertexHeap()
h := newMaxVertexHeap()
vtx0 := &Vtx{
id: GenerateID(),
@ -90,7 +90,7 @@ func TestUniqueVertexHeapReturnsOrdered(t *testing.T) {
}
func TestUniqueVertexHeapRemainsUnique(t *testing.T) {
h := NewMaxVertexHeap()
h := newMaxVertexHeap()
vtx0 := &Vtx{
height: 0,

View File

@ -69,7 +69,7 @@ func (v *voter) Update() {
func (v *voter) bubbleVotes(votes ids.UniqueBag) ids.UniqueBag {
bubbledVotes := ids.UniqueBag{}
vertexHeap := NewMaxVertexHeap()
vertexHeap := newMaxVertexHeap()
for _, vote := range votes.List() {
vtx, err := v.t.Config.State.GetVertex(vote)
if err != nil {

View File

@ -52,7 +52,13 @@ func newConfig(t *testing.T) (BootstrapConfig, ids.ShortID, *common.SenderTest,
peerID := peer.ID()
peers.Add(peer)
handler.Initialize(engine, make(chan common.Message), 1)
handler.Initialize(
engine,
make(chan common.Message),
1,
"",
prometheus.NewRegistry(),
)
timeouts.Initialize(0)
router.Initialize(ctx.Log, timeouts, time.Hour, time.Second)

View File

@ -15,6 +15,7 @@ import (
"github.com/ava-labs/gecko/snow/networking/router"
"github.com/ava-labs/gecko/snow/networking/timeout"
"github.com/ava-labs/gecko/utils/logging"
"github.com/prometheus/client_golang/prometheus"
)
func TestSenderContext(t *testing.T) {
@ -58,7 +59,13 @@ func TestTimeout(t *testing.T) {
}
handler := router.Handler{}
handler.Initialize(&engine, nil, 1)
handler.Initialize(
&engine,
nil,
1,
"",
prometheus.NewRegistry(),
)
go handler.Dispatch()
chainRouter.AddChain(&handler)

View File

@ -1597,7 +1597,13 @@ func TestBootstrapPartiallyAccepted(t *testing.T) {
// Asynchronously passes messages from the network to the consensus engine
handler := &router.Handler{}
handler.Initialize(&engine, msgChan, 1000)
handler.Initialize(
&engine,
msgChan,
1000,
"",
prometheus.NewRegistry(),
)
// Allow incoming messages to be routed to the new chain
chainRouter.AddChain(handler)

View File

@ -105,7 +105,13 @@ func ConsensusLeader(numBlocks, numTxsPerBlock int, b *testing.B) {
// Asynchronously passes messages from the network to the consensus engine
handler := &router.Handler{}
handler.Initialize(&engine, msgChan, 1000)
handler.Initialize(
&engine,
msgChan,
1000,
"",
prometheus.NewRegistry(),
)
// Allow incoming messages to be routed to the new chain
chainRouter.AddChain(handler)
@ -238,7 +244,13 @@ func ConsensusFollower(numBlocks, numTxsPerBlock int, b *testing.B) {
// Asynchronously passes messages from the network to the consensus engine
handler := &router.Handler{}
handler.Initialize(&engine, msgChan, 1000)
handler.Initialize(
&engine,
msgChan,
1000,
"",
prometheus.NewRegistry(),
)
// Allow incoming messages to be routed to the new chain
chainRouter.AddChain(handler)