Skip to content

Commit edb52ce

Browse files
authored
Fix test_runtime_env_container (#54330)
Move `httpx` out of `test_utils` because for some reason it is not available in the image used for `test_runtime_env_container. Signed-off-by: Cindy Zhang <[email protected]>
1 parent 9417d63 commit edb52ce

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

python/ray/serve/_private/test_utils.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
1010

1111
import grpc
12-
import httpx
1312
import requests
1413
from starlette.requests import Request
1514

@@ -425,18 +424,6 @@ def check_telemetry(
425424
return True
426425

427426

428-
CONNECTION_ERROR_MSG = "connection error"
429-
430-
431-
def ping_endpoint(endpoint: str, params: str = ""):
432-
endpoint = endpoint.lstrip("/")
433-
434-
try:
435-
return httpx.get(f"http://localhost:8000/{endpoint}{params}").text
436-
except httpx.HTTPError:
437-
return CONNECTION_ERROR_MSG
438-
439-
440427
def ping_grpc_list_applications(channel, app_names, test_draining=False):
441428
import pytest
442429

python/ray/serve/tests/test_cli_2.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from ray._common.test_utils import wait_for_condition
1818
from ray.serve._private.constants import SERVE_DEFAULT_APP_NAME, SERVE_NAMESPACE
1919
from ray.serve._private.test_utils import (
20-
ping_endpoint,
2120
ping_fruit_stand,
2221
ping_grpc_another_method,
2322
ping_grpc_call_method,
@@ -32,6 +31,15 @@
3231
CONNECTION_ERROR_MSG = "connection error"
3332

3433

34+
def ping_endpoint(endpoint: str, params: str = ""):
35+
endpoint = endpoint.lstrip("/")
36+
37+
try:
38+
return httpx.get(f"http://localhost:8000/{endpoint}{params}").text
39+
except httpx.HTTPError:
40+
return CONNECTION_ERROR_MSG
41+
42+
3543
def check_app_status(app_name: str, expected_status: str):
3644
status_response = subprocess.check_output(["serve", "status"])
3745
status = yaml.safe_load(status_response)["applications"]

python/ray/serve/tests/test_cli_3.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from ray._common.pydantic_compat import BaseModel
1414
from ray._common.test_utils import wait_for_condition
1515
from ray.serve._private.constants import SERVE_DEFAULT_APP_NAME
16-
from ray.serve._private.test_utils import ping_endpoint
1716
from ray.serve.handle import DeploymentHandle
1817
from ray.serve.tests.common.remote_uris import (
1918
TEST_DAG_PINNED_URI,
@@ -23,6 +22,15 @@
2322
CONNECTION_ERROR_MSG = "connection error"
2423

2524

25+
def ping_endpoint(endpoint: str, params: str = ""):
26+
endpoint = endpoint.lstrip("/")
27+
28+
try:
29+
return httpx.get(f"http://localhost:8000/{endpoint}{params}").text
30+
except httpx.HTTPError:
31+
return CONNECTION_ERROR_MSG
32+
33+
2634
def check_app_status(app_name: str, expected_status: str):
2735
status_response = subprocess.check_output(["serve", "status"])
2836
status = yaml.safe_load(status_response)["applications"]

0 commit comments

Comments
 (0)