Hi, I just ran into a very tricky problem. I had a...
# mockk
e
Hi, I just ran into a very tricky problem. I had a mock of an extension function from a test which ended up recording millions of method calls, which ultimately led the test execution to hang completely. In my case I had also forgot to clear mocks at one point, which made the hang happen in a completely different test which didn't make it obvious that the problem was related to a mock at all. Posting here to get some input before possibly filing an issue on octocat I think it would be reasonable that mockk had a (configurable) cap of the amount of recorded invocations, and any further calls throws an exception. The cap should be sufficiently low to not cause an extreme slowdown of tests before throwing exception.
m
that’s indeed a tricky problem: i think it’s pretty rare (it’s actually the first time i’ve seen somebody run into this issue), but it may be ok to put a cap on the number of recorded invocations
e
I'll try to get some numbers on when it becomes a problem and a reproduction case 🙂
m
that’d be great!
e
https://github.com/Kantis/mockk-repro Seems like between 130k - 140k invocations is enough to cause issues.. You can run test with
./gradlew test -i
to see amount of invocations before it just seem to stop..
m
thanks!