Fix flaky tests (#669)
* Fix push identify flaky test * Fix mplex flaky tests * Fix switch flaky test
This commit is contained in:
parent
fffa7e8cc2
commit
8fe44e35c2
|
@ -176,6 +176,9 @@ suite "Identify":
|
|||
|
||||
await identifyPush2.push(switch2.peerInfo, conn)
|
||||
|
||||
check await checkExpiring(switch1.peerStore.protoBook.get(switch2.peerInfo.peerId) == switch2.peerInfo.protocols.toHashSet())
|
||||
check await checkExpiring(switch1.peerStore.addressBook.get(switch2.peerInfo.peerId) == switch2.peerInfo.addrs.toHashSet())
|
||||
|
||||
await closeAll()
|
||||
|
||||
# Wait the very end to be sure that the push has been processed
|
||||
|
@ -197,6 +200,12 @@ suite "Identify":
|
|||
|
||||
await identifyPush2.push(switch2.peerInfo, conn)
|
||||
|
||||
# We have no way to know when the message will is received
|
||||
# because it will fail validation inside push identify itself
|
||||
#
|
||||
# So no choice but to sleep
|
||||
await sleepAsync(10.milliseconds)
|
||||
|
||||
await closeAll()
|
||||
|
||||
# Wait the very end to be sure that the push has been processed
|
||||
|
|
|
@ -816,6 +816,8 @@ suite "Mplex":
|
|||
for i in 0..9:
|
||||
dialStreams.add((await mplexDial.newStream()))
|
||||
|
||||
check await checkExpiring(listenStreams.len == 10 and dialStreams.len == 10)
|
||||
|
||||
await mplexListen.close()
|
||||
await allFuturesThrowing(
|
||||
(dialStreams & listenStreams)
|
||||
|
@ -860,6 +862,8 @@ suite "Mplex":
|
|||
for i in 0..9:
|
||||
dialStreams.add((await mplexDial.newStream()))
|
||||
|
||||
check await checkExpiring(listenStreams.len == 10 and dialStreams.len == 10)
|
||||
|
||||
mplexHandle.cancel()
|
||||
await allFuturesThrowing(
|
||||
(dialStreams & listenStreams)
|
||||
|
@ -901,11 +905,14 @@ suite "Mplex":
|
|||
for i in 0..9:
|
||||
dialStreams.add((await mplexDial.newStream()))
|
||||
|
||||
check await checkExpiring(listenStreams.len == 10 and dialStreams.len == 10)
|
||||
|
||||
await conn.close()
|
||||
await allFuturesThrowing(
|
||||
(dialStreams & listenStreams)
|
||||
.mapIt( it.join() ))
|
||||
|
||||
|
||||
checkTracker(LPChannelTrackerName)
|
||||
|
||||
await conn.closeWithEOF()
|
||||
|
@ -944,7 +951,8 @@ suite "Mplex":
|
|||
for i in 0..9:
|
||||
dialStreams.add((await mplexDial.newStream()))
|
||||
|
||||
await sleepAsync(100.millis)
|
||||
check await checkExpiring(listenStreams.len == 10 and dialStreams.len == 10)
|
||||
|
||||
await listenConn.closeWithEOF()
|
||||
await allFuturesThrowing(
|
||||
(dialStreams & listenStreams)
|
||||
|
|
|
@ -634,7 +634,7 @@ suite "Switch":
|
|||
await switch.start()
|
||||
|
||||
var peerId = PeerID.init(PrivateKey.random(ECDSA, rng[]).get()).get()
|
||||
expect LPStreamClosedError:
|
||||
expect LPStreamClosedError, LPStreamEOFError:
|
||||
await switch.connect(peerId, transport.addrs)
|
||||
|
||||
await handlerWait
|
||||
|
|
Loading…
Reference in New Issue