Closed edeandrea closed 6 months ago
Not sure why the spotless is failing on windows. I ran ./gradlew :spotlessApply
before I committed.
Hi @tomakehurst any chance you might get to review/merge this?
Thanks for raising this @edeandrea, but this behaviour isn't consistent with WireMock's core.
Verification isn't dependent on stubs existing or not, just requests matching the criteria given so I don't think it's a good idea to merge this PR.
Thanks @tomakehurst I'm not sure I understand your comment. This PR doesn't have anything to do with verification. It fixes the fact that the reset behavior doesn't currently reset invocation counters. It brings the WireMockGrpcService.removeAllStubs()
functionality consistent with WireMockServer.resetAll()
. Right now it isn't.
WireMock doesn't have any invocation counters, only events in the request journal. These are totally independent of stubs, so in WireMock core removing a stub (or all stubs) has no effect on the contents of the journal.
However, if we wanted to implement resetRequests()
on a mock gRPC service then finding and removing just the events associated with that service would make sense.
Ok, so maybe what we need here then is a resetAll()
method that matches the one in WireMockServer
? Because thats what's really missing, and what I was really after when I did #27 (I even called it resetAll
originally :) )
Yes, it would also be valid to do this under resetAll()
, although I would using the service part of the URL to filter the events for removal rather than matching stubs, that way if the user has removed a stub already we still clean up corresponding events.
Ok so maybe what I'll do is create a resetRequests()
method where I will reset the events for this service, and then create a resetAll
which just calls the existing removeAllStubs()
and the new resetRequests()
.
Hows that sound?
That sounds good to me 👍
Hi @tomakehurst I've gone ahead and re-worked this PR based on our conversation. I'm not sure why only the windows-11 build is failing due to formatting issues. I did run spotlessApply
before committing anything (I'm on a mac though).
hi @tomakehurst I was curious if you might be doing a release at some point which includes this?
When calling
WireMockGrpcService.removeAllStubs()
it would successfully remove the stubs but it would not reset the counts of any previously-called interactions. This needs to be addressed.This PR addresses this issue and also adds another test to prove that it does what its supposed to do.