From 019144d847355ff59cc2760f37097ffa5497f8c0 Mon Sep 17 00:00:00 2001 From: James Meakin <12661555+jmsmkn@users.noreply.github.com> Date: Fri, 8 Dec 2023 14:59:28 +0100 Subject: [PATCH] Increase httpx timeouts --- tests/conftest.py | 2 +- tests/test_container_image.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index d1af2a9..182a037 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -55,7 +55,7 @@ def minio_container(): ) # Wait for startup - sleep(5) + sleep(1) mpatch = pytest.MonkeyPatch() diff --git a/tests/test_container_image.py b/tests/test_container_image.py index 2e1e07d..1f7a346 100644 --- a/tests/test_container_image.py +++ b/tests/test_container_image.py @@ -117,7 +117,7 @@ def container(): sys.platform != "linux", reason="does not run outside linux" ) def test_container_responds_to_ping(): - response = httpx.get("http://localhost:8080/ping") + response = httpx.get("http://localhost:8080/ping", timeout=30) # SageMaker waits for an HTTP 200 status code and an empty body # for a successful ping request before sending an invocations request. @@ -130,7 +130,9 @@ def test_container_responds_to_ping(): sys.platform != "linux", reason="does not run outside linux" ) def test_container_responds_to_execution_parameters(): - response = httpx.get("http://localhost:8080/execution-parameters") + response = httpx.get( + "http://localhost:8080/execution-parameters", timeout=30 + ) assert response.json() == { "MaxConcurrentTransforms": 1, @@ -154,7 +156,9 @@ def test_invocations_endpoint(minio): "output_bucket_name": minio.output_bucket_name, "output_prefix": f"test/{pk}", } - response = httpx.post("http://localhost:8080/invocations", json=data) + response = httpx.post( + "http://localhost:8080/invocations", json=data, timeout=30 + ) # To obtain inferences, Amazon SageMaker sends a POST request to the # inference container. The POST request body contains data from @@ -188,7 +192,7 @@ def test_alpine_image(minio): "output_prefix": f"test/{pk}", } response = httpx.post( - f"http://localhost:{host_port}/invocations", json=data + f"http://localhost:{host_port}/invocations", json=data, timeout=30 ) response = response.json()