You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2023/05/03 08:21:47 UTC

svn commit: r1909587 - in /httpd/httpd/branches/2.4.x/test/modules/http2: env.py test_003_get.py test_004_post.py test_106_shutdown.py test_200_header_invalid.py test_600_h2proxy.py test_700_load_get.py

Author: icing
Date: Wed May  3 08:21:47 2023
New Revision: 1909587

URL: http://svn.apache.org/viewvc?rev=1909587&view=rev
Log:
tests, synching changes/additions from trunk in http2 tests


Modified:
    httpd/httpd/branches/2.4.x/test/modules/http2/env.py
    httpd/httpd/branches/2.4.x/test/modules/http2/test_003_get.py
    httpd/httpd/branches/2.4.x/test/modules/http2/test_004_post.py
    httpd/httpd/branches/2.4.x/test/modules/http2/test_106_shutdown.py
    httpd/httpd/branches/2.4.x/test/modules/http2/test_200_header_invalid.py
    httpd/httpd/branches/2.4.x/test/modules/http2/test_600_h2proxy.py
    httpd/httpd/branches/2.4.x/test/modules/http2/test_700_load_get.py

Modified: httpd/httpd/branches/2.4.x/test/modules/http2/env.py
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/test/modules/http2/env.py?rev=1909587&r1=1909586&r2=1909587&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/test/modules/http2/env.py (original)
+++ httpd/httpd/branches/2.4.x/test/modules/http2/env.py Wed May  3 08:21:47 2023
@@ -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.*'),

Modified: httpd/httpd/branches/2.4.x/test/modules/http2/test_003_get.py
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/test/modules/http2/test_003_get.py?rev=1909587&r1=1909586&r2=1909587&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/test/modules/http2/test_003_get.py (original)
+++ httpd/httpd/branches/2.4.x/test/modules/http2/test_003_get.py Wed May  3 08:21:47 2023
@@ -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}"

Modified: httpd/httpd/branches/2.4.x/test/modules/http2/test_004_post.py
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/test/modules/http2/test_004_post.py?rev=1909587&r1=1909586&r2=1909587&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/test/modules/http2/test_004_post.py (original)
+++ httpd/httpd/branches/2.4.x/test/modules/http2/test_004_post.py Wed May  3 08:21:47 2023
@@ -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"

Modified: httpd/httpd/branches/2.4.x/test/modules/http2/test_106_shutdown.py
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/test/modules/http2/test_106_shutdown.py?rev=1909587&r1=1909586&r2=1909587&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/test/modules/http2/test_106_shutdown.py (original)
+++ httpd/httpd/branches/2.4.x/test/modules/http2/test_106_shutdown.py Wed May  3 08:21:47 2023
@@ -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

Modified: httpd/httpd/branches/2.4.x/test/modules/http2/test_200_header_invalid.py
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/test/modules/http2/test_200_header_invalid.py?rev=1909587&r1=1909586&r2=1909587&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/test/modules/http2/test_200_header_invalid.py (original)
+++ httpd/httpd/branches/2.4.x/test/modules/http2/test_200_header_invalid.py Wed May  3 08:21:47 2023
@@ -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

Modified: httpd/httpd/branches/2.4.x/test/modules/http2/test_600_h2proxy.py
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/test/modules/http2/test_600_h2proxy.py?rev=1909587&r1=1909586&r2=1909587&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/test/modules/http2/test_600_h2proxy.py (original)
+++ httpd/httpd/branches/2.4.x/test/modules/http2/test_600_h2proxy.py Wed May  3 08:21:47 2023
@@ -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()

Modified: httpd/httpd/branches/2.4.x/test/modules/http2/test_700_load_get.py
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/test/modules/http2/test_700_load_get.py?rev=1909587&r1=1909586&r2=1909587&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/test/modules/http2/test_700_load_get.py (original)
+++ httpd/httpd/branches/2.4.x/test/modules/http2/test_700_load_get.py Wed May  3 08:21:47 2023
@@ -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()