-
Notifications
You must be signed in to change notification settings - Fork 310
Fix for getaddrinfo failures on Windows 10 in MongoDbContainer #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…-py client library to http+docker://localnpipe. Other pipe-like URIs are rewritten this way too. So, the code should detect the http+docker scheme instead of "npipe" and return localhost. Because the check for "http" schemes will inadvertently pick up the http+docker scheme too, do the check for pipes first and for real URLs second.
testcontainers/core/docker_client.py
Outdated
if 'http' in url.scheme or 'tcp' in url.scheme: | ||
return url.hostname | ||
if 'unix' in url.scheme or 'npipe' in url.scheme: | ||
if 'unix' in url.scheme or 'http+docker' == url.scheme: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should npipe
also be included in this check for backwards compatibility?
That’s a good idea. I don’t know when the docker client started replacing npipe with the special URL.
… On Jun 19, 2020, at 2:39 AM, Till Hoffmann ***@***.***> wrote:
@tillahoffmann commented on this pull request.
In testcontainers/core/docker_client.py:
> @@ -62,11 +62,12 @@ def host(self):
except ValueError:
return None
- if 'http' in url.scheme or 'tcp' in url.scheme:
- return url.hostname
- if 'unix' in url.scheme or 'npipe' in url.scheme:
+ if 'unix' in url.scheme or 'http+docker' == url.scheme:
Should npipe also be included in this check for backwards compatibility?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
I updated the pull request with the npipe check. |
Codecov Report
@@ Coverage Diff @@
## master #100 +/- ##
==========================================
+ Coverage 80.61% 81.93% +1.32%
==========================================
Files 20 20
Lines 459 476 +17
Branches 34 35 +1
==========================================
+ Hits 370 390 +20
+ Misses 70 66 -4
- Partials 19 20 +1
Continue to review full report at Codecov.
|
…ntainers-python into npipe-hostname-fix
* adding kafka containers support * Removing the assertions inside the for loop as they are not guarenteed to provide correct feedback
tests/test_nginx_container.py
Outdated
@@ -9,6 +10,7 @@ def test_docker_run_nginx(): | |||
port = nginx.port_to_expose | |||
url = "http://{}:{}/".format(nginx.get_container_host_ip(), | |||
nginx.get_exposed_port(port)) | |||
time.sleep(5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we drop the sleeps?
I have those in my copy because the tests fail on my hardware without them, but I didn’t mean for them to end up in my pull request. Sorry about that, I’ll move them so they aren’t in the pull request.
…Sent from my iPad
On Mar 29, 2021, at 5:14 AM, Till Hoffmann ***@***.***> wrote:
@tillahoffmann commented on this pull request.
In tests/test_nginx_container.py:
> @@ -9,6 +10,7 @@ def test_docker_run_nginx():
port = nginx.port_to_expose
url = "http://{}:{}/".format(nginx.get_container_host_ip(),
nginx.get_exposed_port(port))
+ time.sleep(5)
Can we drop the sleeps?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
* adding support for passing custom env-file (testcontainers#134) * adding support for passing env-file to DockerCompose (testcontainers#134) * fixed flake8 * trigger Gihub Actions again Co-authored-by: Anton Petrosyuk <[email protected]>
…-py client library to http+docker://localnpipe. Other pipe-like URIs are rewritten this way too. So, the code should detect the http+docker scheme instead of "npipe" and return localhost. Because the check for "http" schemes will inadvertently pick up the http+docker scheme too, do the check for pipes first and for real URLs second.
Codecov Report
@@ Coverage Diff @@
## master #100 +/- ##
==========================================
+ Coverage 80.61% 81.93% +1.32%
==========================================
Files 20 20
Lines 459 476 +17
Branches 34 35 +1
==========================================
+ Hits 370 390 +20
+ Misses 70 66 -4
- Partials 19 20 +1
Continue to review full report at Codecov.
|
…ntainers-python into npipe-hostname-fix
…ws that was causing them.
what was the end outcome here? |
Windows npipe URIs are rewritten by the docker-py client library to http+docker://localnpipe. Other pipe-like URIs are rewritten this way too. So,
core/docker_client.py
should detect the http+docker scheme instead of "npipe" and return localhost. Because the check for "http" schemes will inadvertently pick up the http+docker scheme too, do the check for pipes first and for real URLs second. Fixes issue #99. All tests pass with this fix on Windows 10 with Docker Desktop running locally.