Skip to content

Commit

Permalink
test improvements
Browse files Browse the repository at this point in the history
- shut down server again at end of test
- add test_700_20 for connection load on block, viable only
  for 2.5.0 for now
- add data-* gen files to test1 htdocs
  • Loading branch information
icing committed Jul 10, 2024
1 parent d2a709a commit 1370edb
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/modules/http2/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ def _h2_package_scope(env):
'AH10400', # warning that 'enablereuse' has not effect in certain configs
'AH00045', # child did not exit in time, SIGTERM was sent
])
yield
assert env.apache_stop() == 0
7 changes: 7 additions & 0 deletions test/modules/http2/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import os
import subprocess
from shutil import copyfile
from typing import Dict, Any

from pyhttpd.certs import CertificateSpec
Expand Down Expand Up @@ -52,6 +53,12 @@ def _setup_data_1k_1m(self):
with open(os.path.join(self.env.gen_dir, "data-1m"), 'w') as f:
for i in range(10000):
f.write(f"{i:09d}-{s90}")
test1_docs = os.path.join(self.env.server_docs_dir, 'test1')
self.env.mkpath(test1_docs)
for fname in ["data-1k", "data-10k", "data-100k", "data-1m"]:
src = os.path.join(self.env.gen_dir, fname)
dest = os.path.join(test1_docs, fname)
copyfile(src, dest)


class H2TestEnv(HttpdTestEnv):
Expand Down
33 changes: 33 additions & 0 deletions test/modules/http2/test_700_load_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,36 @@ def test_h2_700_11(self, env, conns):
args.append(env.mkurl("https", "cgi", ("/mnot164.py?count=%d&text=%s" % (start+(n*chunk)+i, text))))
r = env.run(args)
self.check_h2load_ok(env, r, chunk)

# test window sizes, connection and stream
@pytest.mark.parametrize("connbits,streambits", [
[10, 16], # 1k connection window, 64k stream windows
[10, 30], # 1k connection window, huge stream windows
[30, 8], # huge conn window, 256 bytes stream windows
])
def test_h2_700_20(self, env, connbits, streambits):
if not env.httpd_is_at_least("2.5.0"):
pytest.skip(f'need at least httpd 2.5.0 for this')
conf = H2Conf(env, extras={
'base': [
'StartServers 1',
]
})
conf.add_vhost_cgi().add_vhost_test1().install()
assert env.apache_restart() == 0
assert env.is_live()
n = 2000
conns = 50
parallel = 10
args = [
env.h2load,
'-n', f'{n}', '-t', '1',
'-c', f'{conns}', '-m', f'{parallel}',
'-W', f'{connbits}', # connection window bits
'-w', f'{streambits}', # stream window bits
f'--connect-to=localhost:{env.https_port}',
f'--base-uri={env.mkurl("https", "test1", "/")}',
"/data-100k"
]
r = env.run(args)
self.check_h2load_ok(env, r, n)

0 comments on commit 1370edb

Please sign in to comment.