Skip to content

Commit

Permalink
Fix flaky websocket test (#7902) (#7904)
Browse files Browse the repository at this point in the history
(cherry picked from commit 28d0b06)
  • Loading branch information
Dreamsorcerer committed Nov 25, 2023
1 parent ddc2a26 commit 946523d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/test_client_ws_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import aiohttp
from aiohttp import hdrs, web
from aiohttp.http import WSCloseCode

if sys.version_info >= (3, 11):
import asyncio as async_timeout
Expand Down Expand Up @@ -581,12 +582,12 @@ async def handler(request):
app.router.add_route("GET", "/", handler)

client = await aiohttp_client(app)
resp = await client.ws_connect("/", heartbeat=0.05)

await resp.receive()
await resp.receive()
resp = await client.ws_connect("/", heartbeat=0.1)

# Connection should be closed roughly after 1.5x heartbeat.
await asyncio.sleep(0.2)
assert ping_received
assert resp.close_code is WSCloseCode.ABNORMAL_CLOSURE


async def test_send_recv_compress(aiohttp_client) -> None:
Expand Down

0 comments on commit 946523d

Please sign in to comment.