Closed pwoolcoc closed 3 years ago
Hey!
Generally speaking: can you give me some more details on what this is useful for? What scenario pushed you to submit this PR?
Talking about the PR: this will just hang forever if assumptions are not verified, that seems a serious pitfall API-wise I am not sure I would like to push onto users.
I use wiremock for an integration test suite where the requests are made to the mock server from a separate container. I'd like to be able to detect when all the conditions are met. Currently I'm using a fork with the above change to accomplish this. You're correct that it will hang, I don't actually .await
on this future directly but wrap it in a timeout mechanism so the future will resolve when the mock server resolves, or when the timeout hits, whichever comes first.
Alternatively, if MockServer::verify
was pub
I could make this work too, if you'd prefer that kind of API change to this one
I'd say let's start with a public verify
method to unblock you.
I understand the usecase, I would probably prefer a dedicated method to cater for it (e.g. block_until_verified
or something along those lines, with a timeout baked in and configurable). It requires some more thinking.
This allows the server to be awaited on, resolving when all the registered mocks are verified.