Skip to content

Commit 46a8168

Browse files
add integration test proving 10 MB buffer handles >64 KB lines
spawns a real subprocess that outputs 100 KB on a single line and verifies readline() succeeds — would crash with the default 64 KB StreamReader limit. Signed-off-by: Vishali <vsanghis@redhat.com>
1 parent 065fa60 commit 46a8168

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

components/runners/ambient-runner/tests/test_gemini_session.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,24 @@ async def test_stream_buffer_limit_raised(self):
9797
call_kwargs = mock_exec.call_args[1]
9898
assert call_kwargs["limit"] == 10 * 1024 * 1024
9999

100+
@pytest.mark.asyncio
101+
async def test_large_stdout_line_does_not_crash(self):
102+
"""A real subprocess outputting >64 KB on one line must not raise ValueError.
103+
104+
Without the 10 MB limit the default 64 KB StreamReader would blow up with:
105+
ValueError: Separator is found, but chunk is longer than limit
106+
"""
107+
payload = "x" * 100_000 # 100 KB — well above the old 64 KB default
108+
proc = await asyncio.create_subprocess_exec(
109+
"python3", "-c", f'print("{payload}")',
110+
stdout=asyncio.subprocess.PIPE,
111+
limit=10 * 1024 * 1024,
112+
)
113+
line = await proc.stdout.readline()
114+
await proc.wait()
115+
assert len(line) > 64 * 1024
116+
assert proc.returncode == 0
117+
100118

101119
class TestWorkerCommandConstruction:
102120
"""Verify the CLI command built by query()."""

0 commit comments

Comments
 (0)