]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
tests: parameterize some h2 tests to make fail cases better visible
authorStefan Eissing <icing@apache.org>
Mon, 22 May 2023 13:08:20 +0000 (13:08 +0000)
committerStefan Eissing <icing@apache.org>
Mon, 22 May 2023 13:08:20 +0000 (13:08 +0000)
- make conf setup for test_h2_004_41 local

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1909982 13f79535-47bb-0310-9956-ffa450edef68

test/modules/http2/test_004_post.py
test/modules/http2/test_500_proxy.py

index 295f989b88ec36a034251e5bb4c622740c3a3f85..e7938f007bdb247441c3439e131b392689ecfeb6 100644 (file)
@@ -18,14 +18,7 @@ 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, extras={
-            f'cgi.{env.http_tld}': [
-                f'<Directory {env.server_docs_dir}/cgi/xxx>',
-                '  RewriteEngine On',
-                '  RewriteRule .* /proxy/echo.py [QSA]',
-                '</Directory>',
-            ]
-        })
+        conf = H2Conf(env)
         conf.add_vhost_cgi(proxy_self=True).install()
         assert env.apache_restart() == 0
 
@@ -190,6 +183,16 @@ 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'<Directory {env.server_docs_dir}/cgi/xxx>',
+                '  RewriteEngine On',
+                '  RewriteRule .* /proxy/echo.py [QSA]',
+                '</Directory>',
+            ]
+        })
+        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
index 309db63fc2d9cebb63b7749ba013e45f9d7ca9c1..6ab8275b11dba0c6caf352abdd402b2c95825159 100644 (file)
@@ -49,11 +49,11 @@ class TestProxy:
             src = file.read()
         assert r2.response["body"] == src
 
-    def test_h2_500_10(self, env, repeat):
-        self.curl_upload_and_verify(env, "data-1k", ["--http2"])
-        self.curl_upload_and_verify(env, "data-10k", ["--http2"])
-        self.curl_upload_and_verify(env, "data-100k", ["--http2"])
-        self.curl_upload_and_verify(env, "data-1m", ["--http2"])
+    @pytest.mark.parametrize("name", [
+        "data-1k", "data-10k", "data-100k", "data-1m",
+    ])
+    def test_h2_500_10(self, env, name, repeat):
+        self.curl_upload_and_verify(env, name, ["--http2"])
 
     def test_h2_500_11(self, env):
         self.curl_upload_and_verify(env, "data-1k", [
@@ -77,17 +77,17 @@ class TestProxy:
                 fd.write(r.stderr)
             assert r.response["body"] == src
 
-    def test_h2_500_20(self, env, repeat):
-        self.nghttp_post_and_verify(env, "data-1k", [])
-        self.nghttp_post_and_verify(env, "data-10k", [])
-        self.nghttp_post_and_verify(env, "data-100k", [])
-        self.nghttp_post_and_verify(env, "data-1m", [])
+    @pytest.mark.parametrize("name", [
+        "data-1k", "data-10k", "data-100k", "data-1m",
+    ])
+    def test_h2_500_20(self, env, name, repeat):
+        self.nghttp_post_and_verify(env, name, [])
 
-    def test_h2_500_21(self, env, repeat):
-        self.nghttp_post_and_verify(env, "data-1k", ["--no-content-length"])
-        self.nghttp_post_and_verify(env, "data-10k", ["--no-content-length"])
-        self.nghttp_post_and_verify(env, "data-100k", ["--no-content-length"])
-        self.nghttp_post_and_verify(env, "data-1m", ["--no-content-length"])
+    @pytest.mark.parametrize("name", [
+        "data-1k", "data-10k", "data-100k", "data-1m",
+    ])
+    def test_h2_500_21(self, env, name, repeat):
+        self.nghttp_post_and_verify(env, name, ["--no-content-length"])
 
     # upload and GET again using nghttp, compare to original content
     def nghttp_upload_and_verify(self, env, fname, options=None):
@@ -107,17 +107,17 @@ class TestProxy:
             src = file.read()
         assert src == r2.response["body"]
 
-    def test_h2_500_22(self, env):
-        self.nghttp_upload_and_verify(env, "data-1k", [])
-        self.nghttp_upload_and_verify(env, "data-10k", [])
-        self.nghttp_upload_and_verify(env, "data-100k", [])
-        self.nghttp_upload_and_verify(env, "data-1m", [])
+    @pytest.mark.parametrize("name", [
+        "data-1k", "data-10k", "data-100k", "data-1m",
+    ])
+    def test_h2_500_22(self, env, name):
+        self.nghttp_upload_and_verify(env, name, [])
 
-    def test_h2_500_23(self, env):
-        self.nghttp_upload_and_verify(env, "data-1k", ["--no-content-length"])
-        self.nghttp_upload_and_verify(env, "data-10k", ["--no-content-length"])
-        self.nghttp_upload_and_verify(env, "data-100k", ["--no-content-length"])
-        self.nghttp_upload_and_verify(env, "data-1m", ["--no-content-length"])
+    @pytest.mark.parametrize("name", [
+        "data-1k", "data-10k", "data-100k", "data-1m",
+    ])
+    def test_h2_500_23(self, env, name):
+        self.nghttp_upload_and_verify(env, name, ["--no-content-length"])
 
     # upload using nghttp and check returned status
     def nghttp_upload_stat(self, env, fname, options=None):
@@ -130,7 +130,7 @@ class TestProxy:
         assert r.response["header"]["location"]
 
     def test_h2_500_24(self, env):
-        for i in range(100):
+        for i in range(50):
             self.nghttp_upload_stat(env, "data-1k", ["--no-content-length"])
 
     # lets do some error tests