Browse Source

some more robust sleeps

pull/845/head
Ethan Buchman 7 years ago
parent
commit
e69d36d54f
2 changed files with 10 additions and 4 deletions
  1. +1
    -1
      mempool/reactor_test.go
  2. +9
    -3
      p2p/switch_test.go

+ 1
- 1
mempool/reactor_test.go View File

@ -81,7 +81,7 @@ func _waitForTxs(t *testing.T, wg *sync.WaitGroup, txs types.Txs, reactorIdx int
mempool := reactors[reactorIdx].Mempool
for mempool.Size() != len(txs) {
time.Sleep(time.Second)
time.Sleep(time.Millisecond * 100)
}
reapedTxs := mempool.Reap(len(txs))


+ 9
- 3
p2p/switch_test.go View File

@ -262,9 +262,15 @@ func TestSwitchReconnectsToPersistentPeer(t *testing.T) {
peer.CloseConn()
// TODO: actually detect the disconnection and wait for reconnect
time.Sleep(100 * time.Millisecond)
assert.NotZero(sw.Peers().Size())
npeers := sw.Peers().Size()
for i := 0; i < 20; i++ {
time.Sleep(100 * time.Millisecond)
npeers = sw.Peers().Size()
if npeers > 0 {
break
}
}
assert.NotZero(npeers)
assert.False(peer.IsRunning())
}


Loading…
Cancel
Save