Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zac-li committed Jul 26, 2023
1 parent 1f33c6f commit 943490a
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tests/integration/jcloud/test_app_timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ async def test_timeout():


def _test_http_route(app_id, timeout):
time.sleep(30)
headers = {
"accept": "application/json",
"Content-Type": "application/json",
Expand Down Expand Up @@ -57,11 +58,9 @@ async def _receive_messages(websocket):
await websocket.send(json.dumps({"interval": 1}))
receive_task = asyncio.create_task(_receive_messages(websocket))
await asyncio.wait_for(receive_task, timeout=timeout)
except asyncio.TimeoutError:
assert math.isclose(
time.time() - start_time, timeout, abs_tol=5
), "WebSocket request timed out at an unexpected time"
except websockets.exceptions.ConnectionClosed as e:
pytest.fail(f"The WebSocket connection was closed unexpectedly: {e}")
else:
pytest.fail("The WebSocket connection should have timed out")
except Exception:
pass

assert math.isclose(
time.time() - start_time, timeout, abs_tol=5
), "WebSocket request timed out at an unexpected time"

0 comments on commit 943490a

Please sign in to comment.