diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2020-06-19 00:53:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-19 09:53:45 +0200 |
commit | 5ad8b9e8ebb2e21e20484afbaffa9450715079cd (patch) | |
tree | 0dc80193eaefd4e95279b0bc2c7f1a6b91ca14a0 | |
parent | 9c42ae91b735bda29de9afbc1333da52a85b3297 (diff) | |
download | Nim-5ad8b9e8ebb2e21e20484afbaffa9450715079cd.tar.gz |
fix #14685 tests/async/t7758.nim flaky (#14721)
* fix #14685 tests/async/t7758.nim flaky * address comment * address comment
-rw-r--r-- | tests/async/t7758.nim | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/async/t7758.nim b/tests/async/t7758.nim index 3cbe16852..fe6d32ad3 100644 --- a/tests/async/t7758.nim +++ b/tests/async/t7758.nim @@ -2,7 +2,8 @@ import asyncdispatch import std/unittest proc task() {.async.} = - await sleepAsync(40) + const tSleep = 40 + await sleepAsync(tSleep) proc main() = var counter = 0 @@ -11,6 +12,10 @@ proc main() = inc(counter) poll(10) - check 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() |