summary refs log tree commit diff stats
path: root/tests/async/t7758.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/async/t7758.nim')
-rw-r--r--tests/async/t7758.nim10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/async/t7758.nim b/tests/async/t7758.nim
index ce4df1fc9..fe6d32ad3 100644
--- a/tests/async/t7758.nim
+++ b/tests/async/t7758.nim
@@ -1,7 +1,9 @@
 import asyncdispatch
+import std/unittest
 
 proc task() {.async.} =
-  await sleepAsync(40)
+  const tSleep = 40
+  await sleepAsync(tSleep)
 
 proc main() =
   var counter = 0
@@ -10,6 +12,10 @@ proc main() =
     inc(counter)
     poll(10)
 
-  doAssert counter <= 4
+  const slack = 1
+    # because there is overhead in `async` + `sleepAsync`
+    # as can be seen by increasing `tSleep` from 40 to 49, which increases the number
+    # of failures.
+  check counter <= 4 + slack
 
 for i in 0 .. 10: main()