python-wiremock icon indicating copy to clipboard operation
python-wiremock copied to clipboard

Increase retry_count for server_running to 10 to account for slower startup times of Wiremock

Open jonassvalin opened this issue 1 year ago • 4 comments

I am using python-wiremock in a project I'm working on. When running with docker-desktop it works fine, but when I switch to colima as the host it appears that it takes slightly longer for the Wiremock server to get ready in the container. I'm running on an M2 Mac.

This is the error I get:

Waiting for container <Container: da6d6427c7f6> with image wiremock/wiremock:2.35.1-1 to be ready ...
Waiting for container <Container: da6d6427c7f6> with image wiremock/wiremock:2.35.1-1 to be ready ...
Request failed: HTTPConnectionPool(host='localhost', port=32847): Max retries exceeded with url: /__admin/mappings (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10dc21be0>: Failed to establish a new connection: [Errno 61] Connection refused'))
Waiting for container <Container: da6d6427c7f6> with image wiremock/wiremock:2.35.1-1 to be ready ...
Request failed: HTTPConnectionPool(host='localhost', port=32847): Max retries exceeded with url: /__admin/mappings (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10dc70550>: Failed to establish a new connection: [Errno 61] Connection refused'))
Waiting for container <Container: da6d6427c7f6> with image wiremock/wiremock:2.35.1-1 to be ready ...
Request failed: HTTPConnectionPool(host='localhost', port=32847): Max retries exceeded with url: /__admin/mappings (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10dc70a50>: Failed to establish a new connection: [Errno 61] Connection refused'))
ERROR                                                                                                                                                                                                                                                      [ 21%]

If I go in to the server_running function in python-wiremock and manually bump up the retry_count to 10 (as per this PR) then it works fine, on the 4th attempt it successfully connects to wiremock.

I think a cleaner solution to my problem would be if we could expose the retry_count as configuration, but I don't have the time to contribute such a major change at the moment. This would solve my problem in the short term, at least.

References

No relevant references

Submitter checklist

  • [x] Recommended: Join WireMock Slack to get any help in #help-contributing or a project-specific channel like #wiremock-java
  • [X] The PR request is well described and justified, including the body and the references
  • [X] The PR title represents the desired changelog entry
  • [X] The repository's code style is followed (see the contributing guide)
  • [X] Test coverage that demonstrates that the change works as expected
  • [X] For new features, there's necessary documentation in this pull request or in a subsequent PR to wiremock.org

jonassvalin avatar Jan 07 '25 15:01 jonassvalin

@oleg-nenashev Do you have a chance to look at this perhaps?

jonassvalin avatar Jan 13 '25 13:01 jonassvalin

Maybe @leeturner ?

jonassvalin avatar Jan 20 '25 10:01 jonassvalin

Is this package abandoned?

FraterCRC avatar Mar 13 '25 17:03 FraterCRC

Is this package abandoned?

I have not been able to reach any of the maintainers unfortunately

jonassvalin avatar Mar 17 '25 09:03 jonassvalin

@oleg-nenashev @leeturner any chance of looking at this?

jonassvalin avatar Apr 29 '25 13:04 jonassvalin

This looks like a safe workaround until we come up with a better solution. I don't see any potential issues arising from this change.

alexjrk avatar Apr 29 '25 14:04 alexjrk

@alexjrk thank you! How do we get this merged and released?

jonassvalin avatar Apr 30 '25 13:04 jonassvalin

I am happy to merge the PR. Not sure at this point how this gets released as I haven't worked on this componenet before

leeturner avatar Apr 30 '25 14:04 leeturner

I just saw that the master branch is actually used for WireMock v2, so I think we should add WireMock v3-related changes to a separate branch (I noticed we already have one called version_3). Then, we can create a new tag (maybe 2.6.2, depending on which new changes we include) for deploying the new release.

alexjrk avatar Apr 30 '25 19:04 alexjrk

Maybe create a tag on this commit, move all the later commits to the version_3 branch, and then add this change to master to create a new release?

alexjrk avatar Apr 30 '25 19:04 alexjrk

@alexjrk @leeturner any progress on getting this released? We're still monkey-patching this workaround which is not ideal

jonassvalin avatar May 12 '25 10:05 jonassvalin

Thank you for your contribution. Sorry for the delay in getting it merged

leeturner avatar Jul 22 '25 15:07 leeturner