diff options
author | Stefan Eissing <icing@apache.org> | 2024-07-10 12:55:23 +0200 |
---|---|---|
committer | Stefan Eissing <icing@apache.org> | 2024-07-10 12:55:23 +0200 |
commit | 98b9ed685ecfbce75a2e613e7738d69da188bc1a (patch) | |
tree | 2d51b17ef0dffe1d2015c5af85d68ff0ee05daa9 /test/modules | |
parent | mod_md: Keep compat with openssl < 1.1 (diff) | |
download | apache2-98b9ed685ecfbce75a2e613e7738d69da188bc1a.tar.xz apache2-98b9ed685ecfbce75a2e613e7738d69da188bc1a.zip |
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
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1919087 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/modules')
-rw-r--r-- | test/modules/http2/conftest.py | 2 | ||||
-rw-r--r-- | test/modules/http2/env.py | 7 | ||||
-rw-r--r-- | test/modules/http2/test_103_upgrade.py | 3 | ||||
-rw-r--r-- | test/modules/http2/test_600_h2proxy.py | 4 | ||||
-rw-r--r-- | test/modules/http2/test_700_load_get.py | 34 | ||||
-rw-r--r-- | test/modules/http2/test_800_websockets.py | 4 |
6 files changed, 50 insertions, 4 deletions
diff --git a/test/modules/http2/conftest.py b/test/modules/http2/conftest.py index c6f8ddee71..118cef1a95 100644 --- a/test/modules/http2/conftest.py +++ b/test/modules/http2/conftest.py @@ -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 diff --git a/test/modules/http2/env.py b/test/modules/http2/env.py index bac1a841be..b2443e003b 100644 --- a/test/modules/http2/env.py +++ b/test/modules/http2/env.py @@ -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): diff --git a/test/modules/http2/test_103_upgrade.py b/test/modules/http2/test_103_upgrade.py index 2fa7d1d68a..1542450df9 100644 --- a/test/modules/http2/test_103_upgrade.py +++ b/test/modules/http2/test_103_upgrade.py @@ -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 diff --git a/test/modules/http2/test_600_h2proxy.py b/test/modules/http2/test_600_h2proxy.py index d175bbdf3b..18a528e9c9 100644 --- a/test/modules/http2/test_600_h2proxy.py +++ b/test/modules/http2/test_600_h2proxy.py @@ -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 diff --git a/test/modules/http2/test_700_load_get.py b/test/modules/http2/test_700_load_get.py index 78760fbf8c..138e74ce85 100644 --- a/test/modules/http2/test_700_load_get.py +++ b/test/modules/http2/test_700_load_get.py @@ -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 diff --git a/test/modules/http2/test_800_websockets.py b/test/modules/http2/test_800_websockets.py index 1456767535..c0fc0c23dc 100644 --- a/test/modules/http2/test_800_websockets.py +++ b/test/modules/http2/test_800_websockets.py @@ -84,8 +84,8 @@ def ws_run(env: H2TestEnv, path, authority=None, do_input=None, inbytes=None, @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: |