Forráskód Böngészése

fix: Skip IPv6 when forced but not available + avoid `none` network

A test on raw IP addresses doesn't reach the existing IPv6 skip logic, added that to avoid a test failing when only IPv4 is available (eg: standard docker container networks).

Additionally some other tests set the `none` network and connecting to this fails as it's not allowed? Preventing that from happening resolves the final failing tests within containerized pytest.
polarathene 3 éve
szülő
commit
115461744b
1 módosított fájl, 8 hozzáadás és 2 törlés
  1. 8 2
      test/conftest.py

+ 8 - 2
test/conftest.py

@@ -239,6 +239,11 @@ def monkey_patch_urllib_dns_resolver():
         logging.getLogger('DNS').debug(f"resolving domain name {repr(args)}")
         _args = list(args)
 
+        # Fail early when querying IP directly and it is forced ipv6 when not supported,
+        # Otherwise a pytest container not using the host network fails to pass `test_raw-ip-vhost`.
+        if FORCE_CONTAINER_IPV6 and not HAS_IPV6:
+            pytest.skip("This system does not support IPv6")
+
         # custom DNS resolvers
         ip = nginx_proxy_dns_resolver(args[0])
         if ip is None:
@@ -366,8 +371,9 @@ def connect_to_network(network):
         if 'host' in my_networks:
             return None
 
-        # make sure our container is connected to the nginx-proxy's network
-        if network.name not in my_networks:
+        # Make sure our container is connected to the nginx-proxy's network,
+        # but avoid connecting to `none` network (not valid) with `test_server-down` tests
+        if network.name not in my_networks and network.name != 'none':
             logging.info(f"Connecting to docker network: {network.name}")
             network.connect(my_container)
             return network