> Am 10.07.2024 um 18:12 schrieb Rainer Jung <rainer.j...@kippdata.de>:
>
> Hi Stefan,
>
> is some of this test stuff ready for 2.4.x?
Synched in r1919126.
> Thanks and regards,
>
> Rainer
>
> Am 10.07.24 um 12:55 schrieb ic...@apache.org:
>> Author: icing
>> Date: Wed Jul 10 10:55:23 2024
>> New Revision: 1919087
>> URL: http://svn.apache.org/viewvc?rev=1919087&view=rev
>> Log:
>> sync test code with mod-h2
>> - shutdown server at end of h2 tests
>> - adapt minimum httpd versions for some tests
>> - add test_700_20 for load on blocked connections,
>> disabled for now until mpm_event improves
>> - build websocket client automatically
>> Modified:
>> httpd/httpd/trunk/test/modules/http2/conftest.py
>> httpd/httpd/trunk/test/modules/http2/env.py
>> httpd/httpd/trunk/test/modules/http2/test_103_upgrade.py
>> httpd/httpd/trunk/test/modules/http2/test_600_h2proxy.py
>> httpd/httpd/trunk/test/modules/http2/test_700_load_get.py
>> httpd/httpd/trunk/test/modules/http2/test_800_websockets.py
>> httpd/httpd/trunk/test/pyhttpd/env.py
>> Modified: httpd/httpd/trunk/test/modules/http2/conftest.py
>> URL:
>> http://svn.apache.org/viewvc/httpd/httpd/trunk/test/modules/http2/conftest.py?rev=1919087&r1=1919086&r2=1919087&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/test/modules/http2/conftest.py (original)
>> +++ httpd/httpd/trunk/test/modules/http2/conftest.py Wed Jul 10 10:55:23 2024
>> @@ -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
>> Modified: httpd/httpd/trunk/test/modules/http2/env.py
>> URL:
>> http://svn.apache.org/viewvc/httpd/httpd/trunk/test/modules/http2/env.py?rev=1919087&r1=1919086&r2=1919087&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/test/modules/http2/env.py (original)
>> +++ httpd/httpd/trunk/test/modules/http2/env.py Wed Jul 10 10:55:23 2024
>> @@ -2,6 +2,7 @@ import inspect
>> import logging
>> import os
>> import subprocess
>> +from shutil import copyfile
>> from typing import Dict, Any
>> from pyhttpd.certs import CertificateSpec
>> @@ -52,6 +53,12 @@ class H2TestSetup(HttpdTestSetup):
>> 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):
>> Modified: httpd/httpd/trunk/test/modules/http2/test_103_upgrade.py
>> URL:
>> http://svn.apache.org/viewvc/httpd/httpd/trunk/test/modules/http2/test_103_upgrade.py?rev=1919087&r1=1919086&r2=1919087&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/test/modules/http2/test_103_upgrade.py (original)
>> +++ httpd/httpd/trunk/test/modules/http2/test_103_upgrade.py Wed Jul 10
>> 10:55:23 2024
>> @@ -90,6 +90,9 @@ class TestUpgrade:
>> url = env.mkurl("http", "test1", "/index.html")
>> r = env.nghttp().get(url, options=["-u"])
>> assert r.response["status"] == 200
>> + # check issue #272
>> + assert 'date' in r.response["header"], f'{r.response}'
>> + assert r.response["header"]["date"] != 'Sun, 00 Jan 1900 00:00:00
>> GMT', f'{r.response}'
>> # upgrade to h2c for a request where http/1.1 is preferred, but the
>> clients upgrade
>> # wish is honored nevertheless
>> Modified: httpd/httpd/trunk/test/modules/http2/test_600_h2proxy.py
>> URL:
>> http://svn.apache.org/viewvc/httpd/httpd/trunk/test/modules/http2/test_600_h2proxy.py?rev=1919087&r1=1919086&r2=1919087&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/test/modules/http2/test_600_h2proxy.py (original)
>> +++ httpd/httpd/trunk/test/modules/http2/test_600_h2proxy.py Wed Jul 10
>> 10:55:23 2024
>> @@ -79,7 +79,7 @@ class TestH2Proxy:
>> assert env.apache_restart() == 0
>> url = env.mkurl("https", "cgi",
>> f"/h2proxy/{env.http_port}/hello.py")
>> # httpd 2.5.0 disables reuse, not matter the config
>> - if enable_reuse == "on" and not env.httpd_is_at_least("2.5.0"):
>> + if enable_reuse == "on" and not env.httpd_is_at_least("2.4.60"):
>> # reuse is not guaranteed for each request, but we expect some
>> # to do it and run on a h2 stream id > 1
>> reused = False
>> @@ -132,7 +132,7 @@ class TestH2Proxy:
>> assert int(r.json[0]["port"]) == env.http_port
>> assert r.response["status"] == 200
>> exp_port = env.http_port if enable_reuse == "on" \
>> - and not env.httpd_is_at_least("2.5.0")\
>> + and not env.httpd_is_at_least("2.4.60")\
>> else env.http_port2
>> assert int(r.json[1]["port"]) == exp_port
>> Modified: httpd/httpd/trunk/test/modules/http2/test_700_load_get.py
>> URL:
>> http://svn.apache.org/viewvc/httpd/httpd/trunk/test/modules/http2/test_700_load_get.py?rev=1919087&r1=1919086&r2=1919087&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/test/modules/http2/test_700_load_get.py (original)
>> +++ httpd/httpd/trunk/test/modules/http2/test_700_load_get.py Wed Jul 10
>> 10:55:23 2024
>> @@ -61,3 +61,37 @@ class TestLoadGet:
>> 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
>> + ])
>> + @pytest.mark.skip('awaiting mpm_event improvements')
>> + 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)
>> \ No newline at end of file
>> Modified: httpd/httpd/trunk/test/modules/http2/test_800_websockets.py
>> URL:
>> http://svn.apache.org/viewvc/httpd/httpd/trunk/test/modules/http2/test_800_websockets.py?rev=1919087&r1=1919086&r2=1919087&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/test/modules/http2/test_800_websockets.py (original)
>> +++ httpd/httpd/trunk/test/modules/http2/test_800_websockets.py Wed Jul 10
>> 10:55:23 2024
>> @@ -84,8 +84,8 @@ def ws_run(env: H2TestEnv, path, authori
>> @pytest.mark.skipif(condition=H2TestEnv.is_unsupported,
>> reason="mod_http2 not supported here")
>> -@pytest.mark.skipif(condition=not H2TestEnv().httpd_is_at_least("2.5.0"),
>> - reason=f'need at least httpd 2.5.0 for this')
>> +@pytest.mark.skipif(condition=not H2TestEnv().httpd_is_at_least("2.4.60"),
>> + reason=f'need at least httpd 2.4.60 for this')
>> @pytest.mark.skipif(condition=ws_version < ws_version_min,
>> reason=f'websockets is {ws_version}, need at least
>> {ws_version_min}')
>> class TestWebSockets:
>> Modified: httpd/httpd/trunk/test/pyhttpd/env.py
>> URL:
>> http://svn.apache.org/viewvc/httpd/httpd/trunk/test/pyhttpd/env.py?rev=1919087&r1=1919086&r2=1919087&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/test/pyhttpd/env.py (original)
>> +++ httpd/httpd/trunk/test/pyhttpd/env.py Wed Jul 10 10:55:23 2024
>> @@ -93,6 +93,7 @@ class HttpdTestSetup:
>> self._make_modules_conf()
>> self._make_htdocs()
>> self._add_aptest()
>> + self._build_clients()
>> self.env.clear_curl_headerfiles()
>> def _make_dirs(self):
>> @@ -196,6 +197,16 @@ class HttpdTestSetup:
>> # load our test module which is not installed
>> fd.write(f"LoadModule aptest_module
>> \"{local_dir}/mod_aptest/.libs/mod_aptest.so\"\n")
>> + def _build_clients(self):
>> + clients_dir = os.path.join(
>> +
>> os.path.dirname(os.path.dirname(inspect.getfile(HttpdTestSetup))),
>> + 'clients')
>> + p = subprocess.run(['make'], capture_output=True, cwd=clients_dir)
>> + rv = p.returncode
>> + if rv != 0:
>> + log.error(f"compiling test clients failed: {p.stderr}")
>> + raise Exception(f"compiling test clients failed: {p.stderr}")
>> +
>> class HttpdTestEnv: