This commit is contained in:
Anton Kaliaev
2019-01-30 20:32:53 +04:00
parent 641182e5d3
commit 54cc5100f8
21 changed files with 170 additions and 212 deletions

View File

@ -41,11 +41,12 @@ func TestNodeStartStop(t *testing.T) {
t.Logf("Started node %v", n.sw.NodeInfo())
// wait for the node to produce a block
blockCh := make(chan interface{})
err = n.EventBus().Subscribe(context.Background(), "node_test", types.EventQueryNewBlock, blockCh)
blocksSub, err := n.EventBus().Subscribe(context.Background(), "node_test", types.EventQueryNewBlock)
require.NoError(t, err)
select {
case <-blockCh:
case <-blocksSub.Out():
case <-blocksSub.Cancelled():
t.Fatal("blocksSub was cancelled")
case <-time.After(10 * time.Second):
t.Fatal("timed out waiting for the node to produce a block")
}