Skip to content

Commit c320a9b

Browse files
committed
cc tests: fix flaky test_client_goaway_metric
commit_hash:5352ac49f6552d13018aa85a52ce72d720ed4357
1 parent 15b7e60 commit c320a9b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

core/functional_tests/http2server/tests/test_low_level.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,14 @@ async def test_client_goaway_metric(create_connection, monitor_client, service_c
549549
async with create_connection() as (sock, conn):
550550
conn.close_connection(error_code=0)
551551
await sock.sendall(conn.data_to_send())
552+
# Keep the socket open until the server reads GOAWAY (and optionally
553+
# responds). Closing immediately races with metrics collection.
554+
with contextlib.suppress(asyncio.TimeoutError):
555+
while True:
556+
receive = await sock.recv(RECEIVE_SIZE, timeout=1.0)
557+
if not receive:
558+
break
559+
conn.receive_data(receive)
552560

553561
assert differ.value_at('goaway') == 1
554562

0 commit comments

Comments
 (0)