diff options
author | Stefan Eissing <icing@apache.org> | 2023-05-03 08:21:47 +0000 |
---|---|---|
committer | Stefan Eissing <icing@apache.org> | 2023-05-03 08:21:47 +0000 |
commit | 525dc658b7baf471a9790a4d24537b2efc25363c (patch) | |
tree | b5516b58d8e7670491ffbb3e70af532c3a993fa7 | |
parent | cb6fbeb6db4d83b855d98a9d98b26269365d3849 (diff) | |
download | httpd-525dc658b7baf471a9790a4d24537b2efc25363c.tar.gz |
tests, synching changes/additions from trunk in http2 tests
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1909587 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | test/modules/http2/env.py | 1 | ||||
-rw-r--r-- | test/modules/http2/test_003_get.py | 4 | ||||
-rw-r--r-- | test/modules/http2/test_004_post.py | 3 | ||||
-rw-r--r-- | test/modules/http2/test_106_shutdown.py | 14 | ||||
-rw-r--r-- | test/modules/http2/test_200_header_invalid.py | 10 | ||||
-rw-r--r-- | test/modules/http2/test_600_h2proxy.py | 9 | ||||
-rw-r--r-- | test/modules/http2/test_700_load_get.py | 18 |
7 files changed, 36 insertions, 23 deletions
diff --git a/test/modules/http2/env.py b/test/modules/http2/env.py index 537d3bf37f..e00aef439d 100644 --- a/test/modules/http2/env.py +++ b/test/modules/http2/env.py @@ -98,6 +98,7 @@ class H2TestEnv(HttpdTestEnv): 'AH01247', # mod_cgid sometimes freaks out on load tests 'AH01110', # error by proxy reading response 'AH10400', # warning that 'enablereuse' has not effect in certain configs test_h2_600 + 'AH00045', # child did not exit in time, SIGTERM was sent ]) self.httpd_error_log.add_ignored_patterns([ re.compile(r'.*malformed header from script \'hecho.py\': Bad header: x.*'), diff --git a/test/modules/http2/test_003_get.py b/test/modules/http2/test_003_get.py index 43751063e0..77afa4feb9 100644 --- a/test/modules/http2/test_003_get.py +++ b/test/modules/http2/test_003_get.py @@ -194,7 +194,7 @@ content-type: text/html @pytest.mark.parametrize("path", [ "/004.html", "/proxy/004.html", "/h2proxy/004.html" ]) - def test_h2_003_50(self, env, path): + def test_h2_003_50(self, env, path, repeat): # check that the resource supports ranges and we see its raw content-length url = env.mkurl("https", "test1", path) # TODO: sometimes we see a 503 here from h2proxy @@ -258,6 +258,7 @@ 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") url = env.mkurl("https", "cgi", "/h2test/error?body_error=timeout") r = env.curl_get(url) assert r.exit_code != 0, f"{r}" @@ -267,6 +268,7 @@ 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") 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 44f31d2cd2..9a5560c83d 100644 --- a/test/modules/http2/test_004_post.py +++ b/test/modules/http2/test_004_post.py @@ -124,6 +124,7 @@ class TestPost: r = env.nghttp().upload_file(url, fpath, options=options) assert r.exit_code == 0 assert r.response["status"] >= 200 and r.response["status"] < 300 + assert 'location' in r.response["header"], f'{r}' assert r.response["header"]["location"] r2 = env.nghttp().get(r.response["header"]["location"]) @@ -131,7 +132,7 @@ class TestPost: assert r2.response["status"] == 200 with open(self.local_src(fpath), mode='rb') as file: src = file.read() - assert src == r2.response["body"] + assert src == r2.response["body"], f'GET {r.response["header"]["location"]}' @pytest.mark.parametrize("name", [ "data-1k", "data-10k", "data-100k", "data-1m" diff --git a/test/modules/http2/test_106_shutdown.py b/test/modules/http2/test_106_shutdown.py index b119292b72..4d0efaae7c 100644 --- a/test/modules/http2/test_106_shutdown.py +++ b/test/modules/http2/test_106_shutdown.py @@ -63,7 +63,13 @@ class TestShutdown: assert env.apache_restart() == 0 url = env.mkurl("https", "test1", "/index.html") for i in range(7): - r = env.curl_get(url, options=['-vvv']) - assert r.exit_code == 0, f"failed on {i}. request: {r.stdout} {r.stderr}" - assert r.response["status"] == 200 - assert "HTTP/2" == r.response["protocol"]
\ No newline at end of file + 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: + # curl send error + assert r.response is None + else: + assert r.exit_code == 0, f"failed on {i}. request: {r.stdout} {r.stderr}" + assert r.response["status"] == 200 + assert "HTTP/2" == r.response["protocol"]
\ No newline at end of file diff --git a/test/modules/http2/test_200_header_invalid.py b/test/modules/http2/test_200_header_invalid.py index fdbfbe4636..2e94c509a4 100644 --- a/test/modules/http2/test_200_header_invalid.py +++ b/test/modules/http2/test_200_header_invalid.py @@ -163,6 +163,8 @@ class TestInvalidHeaders: # invalid chars in method def test_h2_200_16(self, env): + if not env.h2load_is_at_least('1.45.0'): + pytest.skip(f'nhttp2 version too old') conf = H2Conf(env) conf.add_vhost_cgi() conf.install() @@ -171,12 +173,8 @@ class TestInvalidHeaders: opt = ["-H:method: GET /hello.py"] r = env.nghttp().get(url, options=opt) assert r.exit_code == 0, r - # nghttp version >= 1.45.0 check pseudo headers and RST streams, - # which means we see no response. - if r.response is not None: - assert r.response["status"] == 400 + assert r.response is None url = env.mkurl("https", "cgi", "/proxy/hello.py") r = env.nghttp().get(url, options=opt) assert r.exit_code == 0, r - if r.response is not None: - assert r.response["status"] == 400 + assert r.response is None diff --git a/test/modules/http2/test_600_h2proxy.py b/test/modules/http2/test_600_h2proxy.py index e93ba1ae51..d6f1452730 100644 --- a/test/modules/http2/test_600_h2proxy.py +++ b/test/modules/http2/test_600_h2proxy.py @@ -78,7 +78,8 @@ class TestH2Proxy: conf.install() assert env.apache_restart() == 0 url = env.mkurl("https", "cgi", f"/h2proxy/{env.http_port}/hello.py") - if enable_reuse == "on": + # httpd 2.5.0 disables reuse, not matter the config + if enable_reuse == "on" and not env.httpd_is_at_least("2.5.0"): # reuse is not guaranteed for each request, but we expect some # to do it and run on a h2 stream id > 1 reused = False @@ -130,7 +131,9 @@ class TestH2Proxy: assert r.response["previous"]["status"] == 200 assert int(r.json[0]["port"]) == env.http_port assert r.response["status"] == 200 - exp_port = env.http_port if enable_reuse == "on" else env.http_port2 + exp_port = env.http_port if enable_reuse == "on" \ + and not env.httpd_is_at_least("2.5.0")\ + else env.http_port2 assert int(r.json[1]["port"]) == exp_port # lets do some error tests @@ -150,6 +153,7 @@ class TestH2Proxy: # produce an error during response body def test_h2_600_31(self, env, repeat): + pytest.skip("needs fix in core protocol handling") conf = H2Conf(env) conf.add_vhost_cgi(h2proxy_self=True) conf.install() @@ -163,6 +167,7 @@ class TestH2Proxy: # 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") conf = H2Conf(env) conf.add_vhost_cgi(h2proxy_self=True) conf.install() diff --git a/test/modules/http2/test_700_load_get.py b/test/modules/http2/test_700_load_get.py index 9ee8898dfd..78760fbf8c 100644 --- a/test/modules/http2/test_700_load_get.py +++ b/test/modules/http2/test_700_load_get.py @@ -16,14 +16,14 @@ class TestLoadGet: def check_h2load_ok(self, env, r, n): assert 0 == r.exit_code r = env.h2load_status(r) - assert n == r.results["h2load"]["requests"]["total"] - assert n == r.results["h2load"]["requests"]["started"] - assert n == r.results["h2load"]["requests"]["done"] - assert n == r.results["h2load"]["requests"]["succeeded"] - assert n == r.results["h2load"]["status"]["2xx"] - assert 0 == r.results["h2load"]["status"]["3xx"] - assert 0 == r.results["h2load"]["status"]["4xx"] - assert 0 == r.results["h2load"]["status"]["5xx"] + assert n == r.results["h2load"]["requests"]["total"], f'{r.results}' + assert n == r.results["h2load"]["requests"]["started"], f'{r.results}' + assert n == r.results["h2load"]["requests"]["done"], f'{r.results}' + assert n == r.results["h2load"]["requests"]["succeeded"], f'{r.results}' + assert n == r.results["h2load"]["status"]["2xx"], f'{r.results}' + assert 0 == r.results["h2load"]["status"]["3xx"], f'{r.results}' + assert 0 == r.results["h2load"]["status"]["4xx"], f'{r.results}' + assert 0 == r.results["h2load"]["status"]["5xx"], f'{r.results}' # test load on cgi script, single connection, different sizes @pytest.mark.parametrize("start", [ @@ -45,7 +45,7 @@ class TestLoadGet: # test load on cgi script, single connection @pytest.mark.parametrize("conns", [ - 1, 2, 16, 32 + 1, 2, 16 ]) def test_h2_700_11(self, env, conns): assert env.is_live() |