Closed StevenACoffman closed 1 month ago
Cool! Thanks! Would you please add a test case checking the bug. Thanks
We have experienced similar behavior, specifically when running with MatchExpectationsInOrder
set to false
. We have a wait group that executes a couple of queries in parallel with go routines. So the order of queries is unknown, 70% of times the test succeed and the other 30% it gives the error fatal error: sync: unlock of unlocked mutex
from the pgxmock package.
We have tested this change and this does tackle the panic, and since all expectations are met due to the MatchExpectationsInOrder
there are no unmet expectations so the tests pass 100% of the time. It is however a hard testcase to write from our use case :sweat_smile:, since it doesn't fail all of the time.
+1 from us!
Thanks so much for merging! I was trying to circle back to write the tests, but mine were going to be way over complicated. :)
Yeah, this one https://github.com/pashagolub/pgxmock/pull/217 was tricky to catch
This PR avoids many double mutex unlock panics for unexpected calls to methods.
When the call to method was not expected, prior to this PR, pgxmock would not send the proper message back, but would instead panic without giving any message as to what the problem was.