vacp2p / nim-libp2p

libp2p implementation in Nim
https://vacp2p.github.io/nim-libp2p/docs/
MIT License
240 stars 52 forks source link

fix(tests): flaky testdaemon #1123

Closed diegomrsantos closed 2 weeks ago

diegomrsantos commented 2 weeks ago

closes https://github.com/vacp2p/nim-libp2p/issues/1122 and also removes commented code and test.

The issue was actually caused by the use of the flakyAsyncTest with the check macro. When the condition inside check returned false instead of raising an exception, the error message happened.

The proposed solution is to just remove the flakyAsyncTest template and use checkUntilTimeout instead.

This PR also increases the time sleeping inside checkUntilTimeout from 1 to 100 ms. It seemed excessive to retry every 1 ms.

I couldn't reproduce the error anymore after running 100 times locally on macOS. Let's monitor how it behaves on CI.