Browse Source

tests: rename tests/tests-httpd to tests/http

 - httpd is only one server we test with
 - the suite coveres the HTTP protocol in general where
   the default test cases need a more beefy environment

Closes #10654
Stefan Eissing 1 year ago
parent
commit
e497a96a0e

+ 1 - 1
.github/labeler.yml

@@ -157,7 +157,7 @@ HTTP:
 - all: ['lib/h2h3.*']
 - all: ['lib/http*']
 - all: ['tests/http-server.pl']
-- all: ['tests/tests-httpd/*']
+- all: ['tests/http/*']
 
 HTTP/2:
 - all: ['docs/HTTP2.md']

+ 2 - 2
configure.ac

@@ -4654,8 +4654,8 @@ AC_CONFIG_FILES([Makefile \
            tests/server/Makefile \
            tests/libtest/Makefile \
            tests/unit/Makefile \
-           tests/tests-httpd/config.ini \
-           tests/tests-httpd/Makefile \
+           tests/http/config.ini \
+           tests/http/Makefile \
            packages/Makefile \
            packages/vms/Makefile \
            curl-config \

+ 1 - 1
tests/Makefile.am

@@ -48,7 +48,7 @@ BUILD_UNIT =
 DIST_UNIT = unit
 endif
 
-SUBDIRS = certs data server libtest tests-httpd $(BUILD_UNIT)
+SUBDIRS = certs data server libtest http $(BUILD_UNIT)
 DIST_SUBDIRS = $(SUBDIRS) $(DIST_UNIT)
 
 PERLFLAGS = -I$(srcdir)

+ 48 - 0
tests/conftest.py

@@ -0,0 +1,48 @@
+#***************************************************************************
+#                                  _   _ ____  _
+#  Project                     ___| | | |  _ \| |
+#                             / __| | | | |_) | |
+#                            | (__| |_| |  _ <| |___
+#                             \___|\___/|_| \_\_____|
+#
+# Copyright (C) 2008 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at https://curl.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+# SPDX-License-Identifier: curl
+#
+###########################################################################
+#
+import logging
+import os
+import sys
+from typing import Optional
+
+import pytest
+
+
+def pytest_report_header(config, startdir):
+    return f"curl tests"
+
+
+def pytest_addoption(parser):
+    parser.addoption("--repeat", action="store", type=int, default=1,
+                     help='Number of times to repeat each test')
+
+
+def pytest_generate_tests(metafunc):
+    if "repeat" in metafunc.fixturenames:
+        count = int(metafunc.config.getoption("repeat"))
+        metafunc.fixturenames.append('tmp_ct')
+        metafunc.parametrize('repeat', range(count))
+
+

+ 0 - 0
tests/tests-httpd/.gitignore → tests/http/.gitignore


+ 0 - 0
tests/tests-httpd/Makefile.am → tests/http/Makefile.am


+ 4 - 4
tests/tests-httpd/README.md → tests/http/README.md

@@ -59,22 +59,22 @@ curl> pytest -k "test_02_06 and h2"
 Several test cases can be repeated, they all have the `repeat` parameter. To make this work, you have to start `pytest` in the test directory itself (for some unknown reason). Like in:
 
 ```
-curl/tests/tests-httpd> pytest -k "test_02_06 and h2" --repeat=100
+curl/tests/http> pytest -k "test_02_06 and h2" --repeat=100
 ```
 
 which then runs this test case a hundred times. In case of flaky tests, you can make pytest stop on the first one with:
 
 ```
-curl/tests/tests-httpd> pytest -k "test_02_06 and h2" --repeat=100 --maxfail=1
+curl/tests/http> pytest -k "test_02_06 and h2" --repeat=100 --maxfail=1
 ```
 
 which allow you to inspect output and log files for the failed run. Speaking of log files, the verbosity of pytest is also used to collect curl trace output. If you specify `-v` three times, the `curl` command is started with `--trace`:
 
 ```
-curl/tests/tests-httpd> pytest -vvv -k "test_02_06 and h2" --repeat=100 --maxfail=1
+curl/tests/http> pytest -vvv -k "test_02_06 and h2" --repeat=100 --maxfail=1
 ```
 
-all of curl's output and trace file are found in `tests/tests-httpd/gen/curl`.
+all of curl's output and trace file are found in `tests/http/gen/curl`.
 
 ## Writing Tests
 

+ 0 - 0
tests/tests-httpd/config.ini.in → tests/http/config.ini.in


+ 1 - 13
tests/tests-httpd/conftest.py → tests/http/conftest.py

@@ -35,19 +35,7 @@ from testenv import Env, Nghttpx, Httpd
 
 
 def pytest_report_header(config, startdir):
-    return f"curl tests-httpd tests"
-
-
-def pytest_addoption(parser):
-    parser.addoption("--repeat", action="store", type=int, default=1,
-                     help='Number of times to repeat each test')
-
-
-def pytest_generate_tests(metafunc):
-    if "repeat" in metafunc.fixturenames:
-        count = int(metafunc.config.getoption("repeat"))
-        metafunc.fixturenames.append('tmp_ct')
-        metafunc.parametrize('repeat', range(count))
+    return f"curl http tests"
 
 
 @pytest.fixture(scope="package")

+ 0 - 0
tests/tests-httpd/scorecard.py → tests/http/scorecard.py


+ 0 - 0
tests/tests-httpd/test_01_basic.py → tests/http/test_01_basic.py


+ 0 - 0
tests/tests-httpd/test_02_download.py → tests/http/test_02_download.py


+ 0 - 0
tests/tests-httpd/test_03_goaway.py → tests/http/test_03_goaway.py


+ 0 - 0
tests/tests-httpd/test_04_stuttered.py → tests/http/test_04_stuttered.py


+ 0 - 0
tests/tests-httpd/test_05_errors.py → tests/http/test_05_errors.py


+ 0 - 0
tests/tests-httpd/test_06_eyeballs.py → tests/http/test_06_eyeballs.py


+ 0 - 0
tests/tests-httpd/test_07_upload.py → tests/http/test_07_upload.py


+ 0 - 0
tests/tests-httpd/test_08_caddy.py → tests/http/test_08_caddy.py


+ 0 - 0
tests/tests-httpd/test_09_push.py → tests/http/test_09_push.py


+ 0 - 0
tests/tests-httpd/test_10_proxy.py → tests/http/test_10_proxy.py


+ 0 - 0
tests/tests-httpd/test_11_unix.py → tests/http/test_11_unix.py


+ 0 - 0
tests/tests-httpd/testenv/__init__.py → tests/http/testenv/__init__.py


+ 0 - 0
tests/tests-httpd/testenv/caddy.py → tests/http/testenv/caddy.py


+ 0 - 0
tests/tests-httpd/testenv/certs.py → tests/http/testenv/certs.py


+ 0 - 0
tests/tests-httpd/testenv/curl.py → tests/http/testenv/curl.py


+ 1 - 1
tests/tests-httpd/testenv/env.py → tests/http/testenv/env.py

@@ -112,7 +112,7 @@ class EnvConfig:
             'cert': 'xxx',
         }
         self.htdocs_dir = os.path.join(self.gen_dir, 'htdocs')
-        self.tld = 'tests-httpd.curl.se'
+        self.tld = 'http.curl.se'
         self.domain1 = f"one.{self.tld}"
         self.domain2 = f"two.{self.tld}"
         self.proxy_domain = f"proxy.{self.tld}"

+ 0 - 0
tests/tests-httpd/testenv/httpd.py → tests/http/testenv/httpd.py


+ 0 - 0
tests/tests-httpd/testenv/mod_curltest/.gitignore → tests/http/testenv/mod_curltest/.gitignore


+ 0 - 0
tests/tests-httpd/testenv/mod_curltest/mod_curltest.c → tests/http/testenv/mod_curltest/mod_curltest.c


+ 0 - 0
tests/tests-httpd/testenv/nghttpx.py → tests/http/testenv/nghttpx.py