]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
tests, synching changes/additions from trunk in http2 tests
authorStefan Eissing <icing@apache.org>
Wed, 3 May 2023 08:21:47 +0000 (08:21 +0000)
committerStefan Eissing <icing@apache.org>
Wed, 3 May 2023 08:21:47 +0000 (08:21 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1909587 13f79535-47bb-0310-9956-ffa450edef68

test/modules/http2/env.py
test/modules/http2/test_003_get.py
test/modules/http2/test_004_post.py
test/modules/http2/test_106_shutdown.py
test/modules/http2/test_200_header_invalid.py
test/modules/http2/test_600_h2proxy.py
test/modules/http2/test_700_load_get.py

index 537d3bf37f21eb0c72caf6bdf8c90bb096e3bb29..e00aef439d5fbeb7bac84e30b894cc2324c5fd2c 100644 (file)
@@ -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.*'),
index 43751063e0b1c5aeb95acc6af64e3281e1d1740e..77afa4feb906c7d61ccbba7d18682faa3488576c 100644 (file)
@@ -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}"
index 44f31d2cd230c5bdeb0cb43119397c5e6b3defcd..9a5560c83de14dfed96cca81e8958917243943c5 100644 (file)
@@ -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"
index b119292b72d0f0325fecc8a4e5f2db9ba3cacdba..4d0efaae7c4a2ca2c09871e0966af583170f41d6 100644 (file)
@@ -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
index fdbfbe4636ebb69b35ec59674111f91e3390fef1..2e94c509a4b5510d2270a69d1052ba7eead712b2 100644 (file)
@@ -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
index e93ba1ae514fe84b943ee45926a6bda945b11433..d6f145273010bd72eb359f65699ea52406f4b7df 100644 (file)
@@ -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()
index 9ee8898dfd5910278ddc8a2d3be41d1a951d7177..78760fbf8cbf11f19390c89ea1c061b476249dbd 100644 (file)
@@ -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()