From: Stefan Eissing Date: Fri, 30 Jun 2023 08:16:25 +0000 (+0000) Subject: tests: sync mod_http2 tests with mod_h2 and 2.4.x version checks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=236ea1568e18c00ad9016f5fec3c01a38118e4bc;p=thirdparty%2Fapache%2Fhttpd.git tests: sync mod_http2 tests with mod_h2 and 2.4.x version checks git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910701 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/test/modules/http2/test_003_get.py b/test/modules/http2/test_003_get.py index cc7e5117955..57c3775bfd0 100644 --- a/test/modules/http2/test_003_get.py +++ b/test/modules/http2/test_003_get.py @@ -251,7 +251,8 @@ content-type: text/html # produce an error during response body def test_h2_003_71(self, env, repeat): - pytest.skip("needs fix in core protocol handling") + if env.httpd_is_at_least('2.5.0'): + pytest.skip("needs fix in core protocol handling") url = env.mkurl("https", "cgi", "/h2test/error?body_error=timeout") r = env.curl_get(url) assert r.exit_code != 0, f"{r}" @@ -261,7 +262,8 @@ content-type: text/html # produce an error, fail to generate an error bucket def test_h2_003_72(self, env, repeat): - pytest.skip("needs fix in core protocol handling") + if env.httpd_is_at_least('2.5.0'): + pytest.skip("needs fix in core protocol handling") url = env.mkurl("https", "cgi", "/h2test/error?body_error=timeout&error_bucket=0") r = env.curl_get(url) assert r.exit_code != 0, f"{r}" diff --git a/test/modules/http2/test_004_post.py b/test/modules/http2/test_004_post.py index 0095e69990e..295f989b88e 100644 --- a/test/modules/http2/test_004_post.py +++ b/test/modules/http2/test_004_post.py @@ -18,8 +18,15 @@ class TestPost: @pytest.fixture(autouse=True, scope='class') def _class_scope(self, env): TestPost._local_dir = os.path.dirname(inspect.getfile(TestPost)) - conf = H2Conf(env) - conf.add_vhost_cgi(proxy_self=True, h2proxy_self=True).install() + conf = H2Conf(env, extras={ + f'cgi.{env.http_tld}': [ + f'', + ' RewriteEngine On', + ' RewriteRule .* /proxy/echo.py [QSA]', + '', + ] + }) + conf.add_vhost_cgi(proxy_self=True).install() assert env.apache_restart() == 0 def local_src(self, fname): @@ -183,16 +190,6 @@ class TestPost: def test_h2_004_41(self, env): # reproduce PR66597, double chunked encoding on redirects - conf = H2Conf(env, extras={ - f'cgi.{env.http_tld}': [ - f'', - ' RewriteEngine On', - ' RewriteRule .* /proxy/echo.py [QSA]', - '', - ] - }) - conf.add_vhost_cgi(proxy_self=True).install() - assert env.apache_restart() == 0 url = env.mkurl("https", "cgi", "/xxx/test.json") r = env.curl_post_data(url, data="0123456789", options=[]) assert r.exit_code == 0 diff --git a/test/modules/http2/test_106_shutdown.py b/test/modules/http2/test_106_shutdown.py index 4d0efaae7c4..83e143cef58 100644 --- a/test/modules/http2/test_106_shutdown.py +++ b/test/modules/http2/test_106_shutdown.py @@ -66,7 +66,7 @@ class TestShutdown: r = env.curl_get(url, options=['-v']) # requests should succeed, but rarely connections get closed # before the response is received - if r.exit_code == 55: + if r.exit_code in [16, 55]: # curl send error assert r.response is None else: diff --git a/test/modules/http2/test_401_early_hints.py b/test/modules/http2/test_401_early_hints.py index a2c223cbd9d..57043052c2c 100644 --- a/test/modules/http2/test_401_early_hints.py +++ b/test/modules/http2/test_401_early_hints.py @@ -9,6 +9,8 @@ class TestEarlyHints: @pytest.fixture(autouse=True, scope='class') def _class_scope(self, env): + if not env.httpd_is_at_least('2.4.58'): + pytest.skip(f'needs httpd 2.4.58') H2Conf(env).start_vhost(domains=[f"hints.{env.http_tld}"], port=env.https_port, doc_root="htdocs/test1" ).add(""" @@ -67,6 +69,8 @@ class TestEarlyHints: # H2EarlyHints enabled, no PUSH, check that it works for H2EarlyHint def test_h2_401_34(self, env, repeat): + if not env.httpd_is_at_least('2.4.58'): + pytest.skip(f'needs httpd 2.4.58') url = env.mkurl("https", "hints", "/006-early-no-push.html") r = env.nghttp().get(url) assert r.response["status"] == 200 diff --git a/test/modules/http2/test_600_h2proxy.py b/test/modules/http2/test_600_h2proxy.py index d6f14527301..4f071cc4376 100644 --- a/test/modules/http2/test_600_h2proxy.py +++ b/test/modules/http2/test_600_h2proxy.py @@ -153,7 +153,8 @@ class TestH2Proxy: # produce an error during response body def test_h2_600_31(self, env, repeat): - pytest.skip("needs fix in core protocol handling") + if env.httpd_is_at_least('2.5.0'): + pytest.skip("needs fix in core protocol handling") conf = H2Conf(env) conf.add_vhost_cgi(h2proxy_self=True) conf.install() @@ -163,11 +164,12 @@ class TestH2Proxy: # depending on when the error is detect in proxying, if may RST the # stream (exit_code != 0) or give a 503 response. if r.exit_code == 0: - assert r.response['status'] == 503 + assert r.response['status'] == 502 # produce an error, fail to generate an error bucket def test_h2_600_32(self, env, repeat): - pytest.skip("needs fix in core protocol handling") + if env.httpd_is_at_least('2.5.0'): + pytest.skip("needs fix in core protocol handling") conf = H2Conf(env) conf.add_vhost_cgi(h2proxy_self=True) conf.install() diff --git a/test/modules/http2/test_601_h2proxy_twisted.py b/test/modules/http2/test_601_h2proxy_twisted.py index 0079aa69853..45b46d649c5 100644 --- a/test/modules/http2/test_601_h2proxy_twisted.py +++ b/test/modules/http2/test_601_h2proxy_twisted.py @@ -45,6 +45,8 @@ class TestH2ProxyTwisted: "data-1k", "data-10k", "data-100k", "data-1m", ]) def test_h2_601_03_echo_fail_early(self, env, name): + if not env.httpd_is_at_least('2.4.58'): + pytest.skip(f'needs httpd 2.4.58') fpath = os.path.join(env.gen_dir, name) url = env.mkurl("https", "cgi", "/h2proxy/h2test/echo?fail_after=512") r = env.curl_upload(url, fpath, options=[]) @@ -55,6 +57,8 @@ class TestH2ProxyTwisted: "data-1k", "data-10k", "data-100k", "data-1m", ]) def test_h2_601_04_echo_fail_late(self, env, name): + if not env.httpd_is_at_least('2.4.58'): + pytest.skip(f'needs httpd 2.4.58') fpath = os.path.join(env.gen_dir, name) url = env.mkurl("https", "cgi", f"/h2proxy/h2test/echo?fail_after={os.path.getsize(fpath)}") r = env.curl_upload(url, fpath, options=[]) @@ -62,6 +66,8 @@ class TestH2ProxyTwisted: assert r.exit_code == 92 or r.response["status"] == 502 def test_h2_601_05_echo_fail_many(self, env): + if not env.httpd_is_at_least('2.4.58'): + pytest.skip(f'needs httpd 2.4.58') if not env.curl_is_at_least('8.0.0'): pytest.skip(f'need at least curl v8.0.0 for this') count = 200