diff --git a/tests/integration/jcloud/test_basic_app.py b/tests/integration/jcloud/test_basic_app.py index c47dd1f5..f6cffa82 100644 --- a/tests/integration/jcloud/test_basic_app.py +++ b/tests/integration/jcloud/test_basic_app.py @@ -38,11 +38,11 @@ async def _test_ws_route(app_id): await websocket.send(json.dumps({"interval": 1})) received_messages = [] - for _ in range(5): + for _ in range(6): message = await websocket.recv() received_messages.append(message) - assert received_messages == ["0", "1", "2", "3", "4"] + assert received_messages[1:] == ["0", "1", "2", "3", "4"] async def _test_workspace(app_id): @@ -63,6 +63,6 @@ async def _test_workspace(app_id): message = await websocket.recv() received_messages.append(message.strip()) - assert received_messages == [f"Here's string {i}" for i in range(10)] + assert received_messages[1:] == [f"Here's string {i}" for i in range(10)] except ConnectionClosedOK: pass diff --git a/tests/integration/jcloud/test_fastapi_app.py b/tests/integration/jcloud/test_fastapi_app.py index 74d0e9b7..8cf0bae6 100644 --- a/tests/integration/jcloud/test_fastapi_app.py +++ b/tests/integration/jcloud/test_fastapi_app.py @@ -1,11 +1,12 @@ import json +import aiohttp import pytest import requests -import aiohttp from ..helper import deploy_jcloud_fastapi_app + @pytest.mark.asyncio async def test_basic_app(): async with deploy_jcloud_fastapi_app() as app_id: @@ -18,9 +19,7 @@ def _test_http_route(app_id): "accept": "application/json", "Content-Type": "application/json", } - response = requests.get( - f"https://{app_id}.wolf.jina.ai/status", headers=headers - ) + response = requests.get(f"https://{app_id}.wolf.jina.ai/status", headers=headers) response_data = response.json() @@ -35,4 +34,4 @@ async def _test_ws_route(app_id): received_messages = [] async for message in websocket: received_messages.append(message.data) - assert received_messages == ["0", "1", "2", "3", "4"] + assert received_messages[1:] == ["0", "1", "2", "3", "4"] diff --git a/tests/integration/local/test_basic_app.py b/tests/integration/local/test_basic_app.py index a5c513cc..fa5db24c 100644 --- a/tests/integration/local/test_basic_app.py +++ b/tests/integration/local/test_basic_app.py @@ -47,11 +47,11 @@ async def test_basic_app_ws(run_test_app_locally, route): await websocket.send(json.dumps({"interval": 1})) received_messages = [] - for _ in range(5): + for _ in range(6): message = await websocket.recv() received_messages.append(message) - assert received_messages == ["0", "1", "2", "3", "4"] + assert received_messages[1:] == ["0", "1", "2", "3", "4"] @pytest.mark.parametrize( @@ -136,11 +136,11 @@ async def test_basic_app_ws_authorized(run_test_app_locally, route): await websocket.send(json.dumps({"interval": 1})) received_messages = [] - for _ in range(5): + for _ in range(6): message = await websocket.recv() received_messages.append(message) - assert received_messages == ["0", "1", "2", "3", "4"] + assert received_messages[1:] == ["0", "1", "2", "3", "4"] @pytest.mark.parametrize( @@ -284,11 +284,11 @@ async def test_metrics_ws(run_test_app_locally, route): await websocket.send(json.dumps({"interval": 1})) received_messages = [] - for _ in range(5): + for _ in range(6): message = await websocket.recv() received_messages.append(message) - assert received_messages == ["0", "1", "2", "3", "4"] + assert received_messages[1:] == ["0", "1", "2", "3", "4"] start_time = time.time() examine_request_duration_with_retry( @@ -322,8 +322,8 @@ async def test_workspace(run_test_app_locally): await websocket.send(json.dumps({})) received_messages = [] - for _ in range(10): + for _ in range(11): message = await websocket.recv() received_messages.append(message.strip()) - assert received_messages == [f"Here's string {i}" for i in range(10)] + assert received_messages[1:] == [f"Here's string {i}" for i in range(10)] diff --git a/tests/integration/local/test_fastapi_app.py b/tests/integration/local/test_fastapi_app.py index de379e49..c1162821 100644 --- a/tests/integration/local/test_fastapi_app.py +++ b/tests/integration/local/test_fastapi_app.py @@ -68,7 +68,7 @@ async def test_websocket_endpoint(run_fastapi_app_locally, route): received_messages = [] async for message in websocket: received_messages.append(message.data) - assert received_messages == ["0", "1", "2", "3", "4"] + assert received_messages[1:] == ["0", "1", "2", "3", "4"] @pytest.mark.parametrize( @@ -109,11 +109,11 @@ async def test_metrics_ws(run_fastapi_app_locally, route): await websocket.send(json.dumps({"interval": 1})) received_messages = [] - for _ in range(5): + for _ in range(6): message = await websocket.recv() received_messages.append(message) - assert received_messages == ["0", "1", "2", "3", "4"] + assert received_messages[1:] == ["0", "1", "2", "3", "4"] start_time = time.time() examine_request_duration_with_retry(