Merge pull request #824 from tendermint/bugfix/node_test
rewrite node test to use new pubsub
This commit is contained in:
commit
a46f64cd1e
|
@ -1,6 +1,7 @@
|
||||||
package node
|
package node
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -22,10 +23,9 @@ func TestNodeStartStop(t *testing.T) {
|
||||||
t.Logf("Started node %v", n.sw.NodeInfo())
|
t.Logf("Started node %v", n.sw.NodeInfo())
|
||||||
|
|
||||||
// wait for the node to produce a block
|
// wait for the node to produce a block
|
||||||
blockCh := make(chan struct{})
|
blockCh := make(chan interface{})
|
||||||
types.AddListenerForEvent(n.EventSwitch(), "node_test", types.EventStringNewBlock(), func(types.TMEventData) {
|
err = n.EventBus().Subscribe(context.Background(), "node_test", types.EventQueryNewBlock, blockCh)
|
||||||
blockCh <- struct{}{}
|
assert.NoError(t, err)
|
||||||
})
|
|
||||||
select {
|
select {
|
||||||
case <-blockCh:
|
case <-blockCh:
|
||||||
case <-time.After(5 * time.Second):
|
case <-time.After(5 * time.Second):
|
||||||
|
|
Loading…
Reference in New Issue