test_raw-ip-vhost.py 787 B

12345678910111213141516171819
  1. import platform
  2. import pytest
  3. @pytest.mark.xfail(platform.system() == "Darwin", reason="Host to Container IP connection only work on Linux")
  4. def test_raw_ipv4_vhost_forwards_to_web1(docker_compose, nginxproxy):
  5. r = nginxproxy.get("http://172.20.0.4")
  6. assert r.status_code == 200
  7. web1_container = docker_compose.containers.get("web1")
  8. assert r.text == f"I'm {web1_container.id[:12]}\n"
  9. @pytest.mark.xfail(platform.system() == "Darwin", reason="Host to Container IP connection only work on Linux")
  10. def test_raw_ipv6_vhost_forwards_to_web2(docker_compose, nginxproxy):
  11. r = nginxproxy.get("http://[fd00::4]", ipv6=True)
  12. assert r.status_code == 200
  13. web2_container = docker_compose.containers.get("web2")
  14. assert r.text == f"I'm {web2_container.id[:12]}\n"