88
99from api import app , database
1010
11- APPLICATION_HOST = "host.docker.internal "
11+ APPLICATION_HOST = "0.0.0.0 "
1212APPLICATION_PORT = 5001
1313HTTP_STUB_PORT = 8080
1414
@@ -28,7 +28,7 @@ def _stream():
2828@pytest .fixture (scope = "module" )
2929def api_service ():
3030 database .reset ()
31- server = make_server ("0.0.0.0" , APPLICATION_PORT , app )
31+ server = make_server (APPLICATION_HOST , APPLICATION_PORT , app )
3232 thread = threading .Thread (target = server .serve_forever )
3333 thread .start ()
3434 yield
@@ -42,10 +42,11 @@ def test_container():
4242 build_reports_path = Path ("build/reports/specmatic" ).resolve ()
4343 container = (
4444 DockerContainer ("specmatic/specmatic" )
45- .with_command (["test" , f "--host={ APPLICATION_HOST } " , f"--port={ APPLICATION_PORT } " ])
45+ .with_command (["test" , "--host=host.docker.internal " , f"--port={ APPLICATION_PORT } " ])
4646 .with_env ("SPECMATIC_GENERATIVE_TESTS" , "true" )
4747 .with_volume_mapping (specmatic_yaml_path , "/usr/src/app/specmatic.yaml" , mode = "ro" )
4848 .with_volume_mapping (build_reports_path , "/usr/src/app/build/reports/specmatic" , mode = "rw" )
49+ .with_kwargs (extra_hosts = {"host.docker.internal" : "host-gateway" })
4950 .waiting_for (LogMessageWaitStrategy ("Tests run:" ))
5051 )
5152 container .start ()
0 commit comments