|
@@ -34,9 +34,9 @@ test_container = 'nginx-proxy-pytest'
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
-#
|
|
|
+#
|
|
|
# utilities
|
|
|
-#
|
|
|
+#
|
|
|
###############################################################################
|
|
|
|
|
|
@contextlib.contextmanager
|
|
@@ -60,7 +60,7 @@ def ipv6(force_ipv6=True):
|
|
|
|
|
|
class requests_for_docker(object):
|
|
|
"""
|
|
|
- Proxy for calling methods of the requests module.
|
|
|
+ Proxy for calling methods of the requests module.
|
|
|
When a HTTP response failed due to HTTP Error 404 or 502, retry a few times.
|
|
|
Provides method `get_conf` to extract the nginx-proxy configuration content.
|
|
|
"""
|
|
@@ -224,7 +224,7 @@ def docker_container_dns_resolver(domain_name):
|
|
|
|
|
|
ip = container_ip(container)
|
|
|
log.info(f"resolving domain name {domain_name!r} as IP address {ip} of container {container.name}")
|
|
|
- return ip
|
|
|
+ return ip
|
|
|
|
|
|
|
|
|
def monkey_patch_urllib_dns_resolver():
|
|
@@ -306,7 +306,7 @@ def docker_compose_down(compose_file='docker-compose.yml'):
|
|
|
|
|
|
def wait_for_nginxproxy_to_be_ready():
|
|
|
"""
|
|
|
- If one (and only one) container started from image nginxproxy/nginx-proxy:test is found,
|
|
|
+ If one (and only one) container started from image nginxproxy/nginx-proxy:test is found,
|
|
|
wait for its log to contain substring "Watching docker events"
|
|
|
"""
|
|
|
containers = docker_client.containers.list(filters={"ancestor": "nginxproxy/nginx-proxy:test"})
|
|
@@ -416,18 +416,18 @@ def connect_to_all_networks():
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
-#
|
|
|
+#
|
|
|
# Py.test fixtures
|
|
|
-#
|
|
|
+#
|
|
|
###############################################################################
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
|
def docker_compose(request):
|
|
|
"""
|
|
|
pytest fixture providing containers described in a docker compose file. After the tests, remove the created containers
|
|
|
-
|
|
|
+
|
|
|
A custom docker compose file name can be defined in a variable named `docker_compose_file`.
|
|
|
-
|
|
|
+
|
|
|
Also, in the case where pytest is running from a docker container, this fixture makes sure
|
|
|
our container will be attached to all the docker networks.
|
|
|
"""
|
|
@@ -463,9 +463,9 @@ def nginxproxy():
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
-#
|
|
|
+#
|
|
|
# Py.test hooks
|
|
|
-#
|
|
|
+#
|
|
|
###############################################################################
|
|
|
|
|
|
# pytest hook to display additionnal stuff in test report
|
|
@@ -492,9 +492,9 @@ def pytest_runtest_setup(item):
|
|
|
pytest.xfail(f"previous test failed ({previousfailed.name})")
|
|
|
|
|
|
###############################################################################
|
|
|
-#
|
|
|
+#
|
|
|
# Check requirements
|
|
|
-#
|
|
|
+#
|
|
|
###############################################################################
|
|
|
|
|
|
try:
|