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
This commit is contained in:
Stefan Eissing 2023-03-01 16:55:31 +01:00 committed by Daniel Stenberg
parent 9fd2d5aa72
commit e497a96a0e
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
30 changed files with 58 additions and 22 deletions

2
.github/labeler.yml vendored
View File

@ -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']

View File

@ -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 \

View File

@ -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
tests/conftest.py Normal file
View File

@ -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))

View File

@ -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

View File

@ -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")

View File

@ -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}"