diff --git a/tests/commoninterop.nim b/tests/commoninterop.nim index 9c2b7b0fb..5292e4d14 100644 --- a/tests/commoninterop.nim +++ b/tests/commoninterop.nim @@ -80,7 +80,7 @@ proc testPubSubDaemonPublish( await nativeNode.connect(daemonPeer.peer, daemonPeer.addresses) - await sleepAsync(1.seconds) + await sleepAsync(500.millis) await daemonNode.connect(nativePeer.peerId, nativePeer.addrs) proc pubsubHandler( @@ -90,12 +90,12 @@ proc testPubSubDaemonPublish( asyncDiscard daemonNode.pubsubSubscribe(testTopic, pubsubHandler) pubsub.subscribe(testTopic, nativeHandler) - await sleepAsync(5.seconds) + await sleepAsync(3.seconds) proc publisher() {.async.} = while not finished: await daemonNode.pubsubPublish(testTopic, msgData) - await sleepAsync(500.millis) + await sleepAsync(250.millis) await wait(publisher(), 5.minutes) # should be plenty of time @@ -132,7 +132,7 @@ proc testPubSubNodePublish( await nativeNode.connect(daemonPeer.peer, daemonPeer.addresses) - await sleepAsync(1.seconds) + await sleepAsync(500.millis) await daemonNode.connect(nativePeer.peerId, nativePeer.addrs) var times = 0 @@ -152,12 +152,12 @@ proc testPubSubNodePublish( discard pubsub.subscribe(testTopic, nativeHandler) - await sleepAsync(5.seconds) + await sleepAsync(3.seconds) proc publisher() {.async.} = while not finished: discard await pubsub.publish(testTopic, msgData) - await sleepAsync(500.millis) + await sleepAsync(250.millis) await wait(publisher(), 5.minutes) # should be plenty of time @@ -210,7 +210,7 @@ proc commonInteropTests*(name: string, swCreator: SwitchCreator) = await nativeNode.stop() await daemonNode.close() - await sleepAsync(1.seconds) + await sleepAsync(500.millis) asyncTest "native -> daemon connection": var protos = @["/test-stream"] @@ -292,7 +292,7 @@ proc commonInteropTests*(name: string, swCreator: SwitchCreator) = await stream.close() await nativeNode.stop() await daemonNode.close() - await sleepAsync(1.seconds) + await sleepAsync(500.millis) asyncTest "native -> daemon websocket connection": var protos = @["/test-stream"] @@ -343,7 +343,7 @@ proc commonInteropTests*(name: string, swCreator: SwitchCreator) = await stream.close() await nativeNode.stop() await daemonNode.close() - await sleepAsync(1.seconds) + await sleepAsync(500.millis) asyncTest "daemon -> native websocket connection": var protos = @["/test-stream"] diff --git a/tests/pubsub/testscoring.nim b/tests/pubsub/testscoring.nim index 8411dfad3..3bc78a183 100644 --- a/tests/pubsub/testscoring.nim +++ b/tests/pubsub/testscoring.nim @@ -41,7 +41,7 @@ suite "GossipSub Scoring": gossipSub.updateScores() - await sleepAsync(100.millis) + await sleepAsync(50.millis) check: # test our disconnect mechanics diff --git a/tests/testautonatservice.nim b/tests/testautonatservice.nim index 5738b86b5..e20a11050 100644 --- a/tests/testautonatservice.nim +++ b/tests/testautonatservice.nim @@ -481,7 +481,7 @@ suite "Autonat Service": awaiter = newFuture[void]() await autonatService.run(switch1) - await sleepAsync(200.millis) + await sleepAsync(100.millis) check autonatService.networkReachability == NetworkReachability.Reachable check libp2p_autonat_reachability_confidence.value(["Reachable"]) == 1 @@ -510,6 +510,6 @@ suite "Autonat Service": await switch2.connect(switch1.peerInfo.peerId, switch1.peerInfo.addrs) - await sleepAsync(500.milliseconds) + await sleepAsync(250.milliseconds) await allFuturesThrowing(switch1.stop(), switch2.stop()) diff --git a/tests/testautorelay.nim b/tests/testautorelay.nim index c75d87431..53765b309 100644 --- a/tests/testautorelay.nim +++ b/tests/testautorelay.nim @@ -86,7 +86,7 @@ suite "Autorelay": let autorelay = AutoRelayService.new(3, relayClient, checkMA, newRng()) switchClient = createSwitch(relayClient, autorelay) await allFutures(switchClient.start(), switchRelay.start()) - await sleepAsync(500.millis) + await sleepAsync(250.millis) await switchClient.connect(switchRelay.peerInfo.peerId, switchRelay.peerInfo.addrs) await fut.wait(1.seconds) let addresses = autorelay.getAddresses() diff --git a/tests/testdaemon.nim b/tests/testdaemon.nim index e46958378..41bc97992 100644 --- a/tests/testdaemon.nim +++ b/tests/testdaemon.nim @@ -88,7 +88,7 @@ proc pubsubTest(f: set[P2PDaemonFlags]): Future[bool] {.async.} = var ticket1 = await api1.pubsubSubscribe("test-topic", pubsubHandler1) var ticket2 = await api2.pubsubSubscribe("test-topic", pubsubHandler2) - await sleepAsync(2.seconds) + await sleepAsync(1.seconds) var topics1 = await api1.pubsubGetTopics() var topics2 = await api2.pubsubGetTopics() @@ -98,10 +98,10 @@ proc pubsubTest(f: set[P2PDaemonFlags]): Future[bool] {.async.} = var peers2 = await api2.pubsubListPeers("test-topic") if len(peers1) == 1 and len(peers2) == 1: # Publish test data via api1. - await sleepAsync(500.milliseconds) + await sleepAsync(250.milliseconds) await api1.pubsubPublish("test-topic", msgData) var res = - await one(allFutures(handlerFuture1, handlerFuture2), sleepAsync(10.seconds)) + await one(allFutures(handlerFuture1, handlerFuture2), sleepAsync(5.seconds)) await api1.close() await api2.close() diff --git a/tests/testdcutr.nim b/tests/testdcutr.nim index 580aa5b67..3b49b09e9 100644 --- a/tests/testdcutr.nim +++ b/tests/testdcutr.nim @@ -115,7 +115,7 @@ suite "Dcutr": reuseConnection = true, dir = Direction.Out, ): Future[void] {.async: (raises: [DialFailedError, CancelledError]).} = - await sleepAsync(100.millis) + await sleepAsync(50.millis) let behindNATSwitch = SwitchStub.new(newStandardSwitch(), connectTimeoutProc) let publicSwitch = newStandardSwitch() @@ -194,7 +194,7 @@ suite "Dcutr": reuseConnection = true, dir = Direction.Out, ): Future[void] {.async: (raises: [DialFailedError, CancelledError]).} = - await sleepAsync(100.millis) + await sleepAsync(50.millis) await ductrServerTest(connectProc) diff --git a/tests/testfuture.nim b/tests/testfuture.nim index 9f9a8cd4d..effd708aa 100644 --- a/tests/testfuture.nim +++ b/tests/testfuture.nim @@ -17,10 +17,10 @@ import ./helpers suite "Future": asyncTest "anyCompleted must complete with first completed future": proc fut1() {.async.} = - await sleepAsync(100.milliseconds) + await sleepAsync(50.milliseconds) proc fut2() {.async.} = - await sleepAsync(200.milliseconds) + await sleepAsync(100.milliseconds) proc fut3() {.async.} = raise newException(CatchableError, "fut3") @@ -55,10 +55,10 @@ suite "Future": asyncTest "anyCompleted with timeout": proc fut1() {.async.} = - await sleepAsync(100.milliseconds) + await sleepAsync(50.milliseconds) proc fut2() {.async.} = - await sleepAsync(200.milliseconds) + await sleepAsync(100.milliseconds) proc fut3() {.async: (raises: [ValueError]).} = # fut3 intentionally specifies raised ValueError diff --git a/tests/testhelpers.nim b/tests/testhelpers.nim index a8ea0d4e0..cf968e036 100644 --- a/tests/testhelpers.nim +++ b/tests/testhelpers.nim @@ -32,7 +32,7 @@ suite "checkUntilTimeout helpers": var a = 1 let b = 2 proc makeConditionTrueLater() {.async.} = - await sleepAsync(100.milliseconds) + await sleepAsync(50.milliseconds) a = 2 asyncSpawn makeConditionTrueLater() @@ -57,7 +57,7 @@ suite "checkUntilTimeout helpers": var a = 1 let b = 2 proc makeConditionTrueLater() {.async.} = - await sleepAsync(100.milliseconds) + await sleepAsync(50.milliseconds) a = 2 asyncSpawn makeConditionTrueLater() diff --git a/tests/testhpservice.nim b/tests/testhpservice.nim index c45ffeb49..1ed29dc48 100644 --- a/tests/testhpservice.nim +++ b/tests/testhpservice.nim @@ -241,7 +241,7 @@ suite "Hole Punching": switchAux.peerInfo.peerId, switchAux.peerInfo.addrs ) - await sleepAsync(200.millis) + await sleepAsync(100.millis) await privatePeerSwitch1.connect( switchAux2.peerInfo.peerId, switchAux2.peerInfo.addrs @@ -270,7 +270,7 @@ suite "Hole Punching": privatePeerSwitch2.connectStub = rcvConnectStub # wait for hole punching to finish in the background - await sleepAsync(600.millis) + await sleepAsync(300.millis) await allFuturesThrowing( privatePeerSwitch1.stop(), diff --git a/tests/testmplex.nim b/tests/testmplex.nim index 329ae1e82..27c817997 100644 --- a/tests/testmplex.nim +++ b/tests/testmplex.nim @@ -556,7 +556,7 @@ suite "Mplex": listenJob.complete() await mplexListen.handle() - await sleepAsync(1.seconds) # give chronos some slack to process things + await sleepAsync(500.millis) # give chronos some slack to process things await mplexListen.close() except CancelledError as exc: raise exc