From 19264da4db63cd5a6dd2094498ca61e4e956f000 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=A0t=C4=9Bp=C3=A1n=20Bal=C3=A1=C5=BEik?= Date: Thu, 16 Jul 2026 22:08:51 +0200 Subject: [PATCH] fixup! Port the long TCP stream test to Python --- bin/tests/system/tcp/tests_tcp.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/bin/tests/system/tcp/tests_tcp.py b/bin/tests/system/tcp/tests_tcp.py index 6d80208ca9b..766ed66ca59 100644 --- a/bin/tests/system/tcp/tests_tcp.py +++ b/bin/tests/system/tcp/tests_tcp.py @@ -258,15 +258,25 @@ async def send_long_tcp_stream( reader, writer = await asyncio.open_connection(host, port) discard_task = asyncio.create_task(discard_stream(reader)) try: - remaining = frames_remaining - while remaining > 0: - frames = min(chunk_frames, remaining) - writer.write(frame * frames) + # The server may close the connection before we have written the + # whole stream. This shows up notably on Alma Linux 8: under + # concurrent load its small default TCP buffers let the flow + # control between us and named wedge, named then hits its idle + # timeout and resets the connection mid-write, and drain() raises + # ConnectionResetError. That is fine -- the connection being torn + # down is acceptable and the only thing this test asserts is that + # named survives the flood, which the query below checks -- so + # tolerate the server closing the connection early. + with contextlib.suppress(ConnectionResetError): + remaining = frames_remaining + while remaining > 0: + frames = min(chunk_frames, remaining) + writer.write(frame * frames) + await writer.drain() + remaining -= frames + + writer.write_eof() await writer.drain() - remaining -= frames - - writer.write_eof() - await writer.drain() writer.close() with contextlib.suppress(ConnectionError, OSError): -- 2.47.3