Use `TestControl.executeEmbed` for time-based tests
See original GitHub issueI noticed a flake in the server TimeoutSuite
yesterday and realized that many/all of our time-based tests are actually running against real time, I believe.
In Cats Effect 3.3 TestControl.executeEmbed
was introduced as a way of running an IO
against “simulated” time instead of real time. This allows the test to run much more quickly (since it can simulate a sleep instantly, instead of actually sleeping) and more reliably.
Cats Effect docs: https://typelevel.org/cats-effect/docs/core/test-runtime#full-execution
I recently used executeEmbed
in https://github.com/typelevel/fs2/pull/2922, as an example 😃
So executeEmbed
should be sprinkled in the appropriate places in our test suite. The Timeout
suite is a good place to start 😃
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
http4s - bytemeta
Use `TestControl.executeEmbed` for time-based tests. christiankjaer. christiankjaer CLOSED · Updated 5 months ago · AuthMiddleware with Ember backend ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
thanks @armanbilge and sorry for all the trouble!
I’ve tried to apply
TestControl
in tests and many times faced with this. But sure, maybe I was doing something wrong, just wanted to add some nota bene 😃