Browse Source

tests: skip test_proxy-host-network-mode when PYTEST_RUNNING_IN_CONTAINER

Connecting to host network not supported when pytest is running in container
Niek 3 tháng trước cách đây
mục cha
commit
15e6fa8e07
1 tập tin đã thay đổi với 10 bổ sung0 xóa
  1. 10 0
      test/test_host-network-mode/test_proxy-host-network-mode.py

+ 10 - 0
test/test_host-network-mode/test_proxy-host-network-mode.py

@@ -1,5 +1,15 @@
 # Note: on Docker Desktop, host networking must be manually enabled.
 # See https://docs.docker.com/engine/network/drivers/host/
+import os
+
+import pytest
+
+PYTEST_RUNNING_IN_CONTAINER = os.environ.get('PYTEST_RUNNING_IN_CONTAINER') == "1"
+
+pytestmark = pytest.mark.skipif(
+    PYTEST_RUNNING_IN_CONTAINER,
+    reason="Connecting to host network not supported when pytest is running in container"
+)
 
 def test_forwards_to_host_network_container_1(docker_compose, nginxproxy):
     r = nginxproxy.get("http://host-network-1.nginx-proxy.tld:8888/port")