$count can be different than callLog potential threading issue

Description

I am testing a process that threads out calls. I was mocking the calls and attempting to assert on the number of times the mocked method was called inside the threads. What I find is that the number of times recorded is not consistent, and my assertion fails fairly regularly in repeated runs of the test. Interestingly enough the $callLog does record each time, so changing my assertion to use the length of that array appears to be stable and correct.

My assumption is that somehow the fact that the calls are being made in threads is allowing the counter to get out of sync.. It is always off by only 1.

such that
expect(variables.mockBpoImageManager.$callLog()["saveImageFile"].len()).toBe(variables.mockBpoImageManager.$count("saveImageFile"));

fails occasionally

Assignee

Luis Majano

Reporter

Curt Miller

Labels

None

Affects versions

Priority

Major
Configure