pytest: test 07_70 stabilize (curl_ngtcp2)

We recently allowed a larger send buffer in ngtcp2 streams. This allowed
curl to send more early data then previously when the server was slow in
performing the handshake. This led to flaky test failures when the
amount of early data was larger than expected.

Change test expectations to allow for varying amount of early data.

Ref: #20112
Closes #20161
This commit is contained in:
Stefan Eissing 2026-01-02 12:46:35 +01:00 committed by Viktor Szakats
parent ac06643f71
commit 2c32ab12a0
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
2 changed files with 21 additions and 22 deletions

View file

@ -639,21 +639,18 @@ class TestUpload:
])
r.check_exit_code(0)
# nghttpx is the only server we have that supports TLS early data and
# has a limit of 16k it announces
# nghttpx is the only server we have that supports TLS early data
@pytest.mark.skipif(condition=not Env.have_nghttpx(), reason="no nghttpx")
@pytest.mark.parametrize("proto,upload_size,exp_early", [
pytest.param('http/1.1', 100, 203, id='h1-small-body'),
pytest.param('http/1.1', 10*1024, 10345, id='h1-medium-body'),
pytest.param('http/1.1', 32*1024, 16384, id='h1-limited-body'),
pytest.param('h2', 10*1024, 10378, id='h2-medium-body'),
pytest.param('h2', 32*1024, 16384, id='h2-limited-body'),
pytest.param('h3', 1024, 1126, id='h3-small-body'),
pytest.param('h3', 1024 * 1024, 131177, id='h3-limited-body'),
# h3: limited+body (long app data). The 0RTT size is limited by
# our sendbuf size of 128K.
@pytest.mark.parametrize("proto,upload_size", [
pytest.param('http/1.1', 100, id='h1-small-body'),
pytest.param('http/1.1', 10*1024, id='h1-medium-body'),
pytest.param('http/1.1', 32*1024, id='h1-limited-body'),
pytest.param('h2', 10*1024, id='h2-medium-body'),
pytest.param('h2', 32*1024, id='h2-limited-body'),
pytest.param('h3', 1024, id='h3-small-body'),
pytest.param('h3', 1024 * 1024, id='h3-limited-body'),
])
def test_07_70_put_earlydata(self, env: Env, httpd, nghttpx, proto, upload_size, exp_early):
def test_07_70_put_earlydata(self, env: Env, httpd, nghttpx, proto, upload_size):
if not env.curl_can_early_data():
pytest.skip('TLS earlydata not implemented')
if proto == 'h2' and not env.have_h2_curl():
@ -693,10 +690,12 @@ class TestUpload:
m = re.match(r'^\[t-(\d+)] EarlyData: (-?\d+)', line)
if m:
earlydata[int(m.group(1))] = int(m.group(2))
# 1st transfer did not use early data
assert earlydata[0] == 0, f'{earlydata}\n{r.dump_logs()}'
# depending on cpu load, curl might not upload as much before
# the handshake starts and early data stops.
assert 0 < earlydata[1] <= exp_early, f'{earlydata}\n{r.dump_logs()}'
# depending on cpu load, the amount of early data might differ.
# when the server is slow, we might send more. when curl is slow,
# we might send less before the server handshakes.
assert 0 < earlydata[1] <= (upload_size + 1024), f'{earlydata}\n{r.dump_logs()}'
def check_downloads(self, client, r, source: List[str], count: int,
complete: bool = True):