Closed aronisstav closed 3 years ago
Hmm... it might be the case that gen_server:stop bypasses sys:suspend, which is what the failed test relies on. A different solution to the same problem is to make 'unload' issue a call with infinite timeout. That will need a custom variant of the "gen_server" function. Shall I try fixing it that way?
Interesting fix. This might be the cause of a few hard-to-reproduce not_mocked
errors previously reported.
Can you reproduce the failed test case on your end?
Hmm... it might be the case that gen_server:stop bypasses sys:suspend, which is what the failed test relies on. A different solution to the same problem is to make 'unload' issue a call with infinite timeout. That will need a custom variant of the "gen_server" function. Shall I try fixing it that way?
That sounds like a good idea!
Updated!
Seems the exception is triggered somehow. Maybe try locally and remove the try catch to see which exception is thrown there. Can you reproduce the failing test cases?
Now tests pass locally. I had accidentally commited some debug-related code.
Looks good. Can you update the CHANGELOG.md
too, and squash everything to one commit?
I'd prefer the commit message to be Increase stop timeout to infinity
instead, if you agree.
Done!
@aronisstav Last minor thing: the changelog entry needs to be under ## [Unreleased]
. Sorry for not being clearer about that.
Sorry, fixed again.
Thank you! ❤️
When stopping (e.g. due to meck:unload/1), meck_procs restore the original module, which may be a time consuming operation. If a gen_server:call is used for stopping, there's risk of a timeout that will be translated to a confusing error:{not_mocked}. Using gen_server:stop/1 easily uses an infinity timeout, preventing the issue.
This is fixing a bug where such a time-consuming restoration was causing an end_per_suite operation to fail, confusingly.