TUN-6810: Add component test for post-quantum

This commit is contained in:
Devin Carr 2022-09-28 12:25:54 -07:00
parent cbf8c71fab
commit d7fb18be22
3 changed files with 45 additions and 8 deletions

View File

@ -195,6 +195,26 @@ stretch: &stretch
- ./fmt-check.sh - ./fmt-check.sh
- make test | gotest-to-teamcity - make test | gotest-to-teamcity
component-test: component-test:
build_dir: *build_dir
builddeps:
- *pinned_go
- python3.7
- python3-pip
- python3-setuptools
# procps installs the ps command which is needed in test_sysv_service because the init script
# uses ps pid to determine if the agent is running
- procps
pre-cache-copy-paths:
- component-tests/requirements.txt
pre-cache: &component_test_pre_cache
- sudo pip3 install --upgrade -r component-tests/requirements.txt
post-cache: &component_test_post_cache
# Creates and routes a Named Tunnel for this build. Also constructs config file from env vars.
- python3 component-tests/setup.py --type create
- pytest component-tests -o log_cli=true --log-cli-level=INFO
# The Named Tunnel is deleted and its route unprovisioned here.
- python3 component-tests/setup.py --type cleanup
component-test-fips:
build_dir: *build_dir build_dir: *build_dir
builddeps: builddeps:
- *pinned_go_fips - *pinned_go_fips
@ -206,14 +226,8 @@ stretch: &stretch
- procps - procps
pre-cache-copy-paths: pre-cache-copy-paths:
- component-tests/requirements.txt - component-tests/requirements.txt
pre-cache: pre-cache: *component_test_pre_cache
- sudo pip3 install --upgrade -r component-tests/requirements.txt post-cache: *component_test_post_cache
post-cache:
# Creates and routes a Named Tunnel for this build. Also constructs config file from env vars.
- python3 component-tests/setup.py --type create
- pytest component-tests -o log_cli=true --log-cli-level=INFO
# The Named Tunnel is deleted and its route unprovisioned here.
- python3 component-tests/setup.py --type cleanup
update-homebrew: update-homebrew:
builddeps: builddeps:
- openssh-client - openssh-client

View File

@ -0,0 +1,17 @@
from util import LOGGER, nofips, start_cloudflared, wait_tunnel_ready
@nofips
class TestPostQuantum:
def _extra_config(self):
config = {
"protocol": "quic",
}
return config
def test_post_quantum(self, tmp_path, component_tests_config):
config = component_tests_config(self._extra_config())
LOGGER.debug(config)
with start_cloudflared(tmp_path, config, cfd_args=["run", "--post-quantum"], new_process=True):
wait_tunnel_ready(tunnel_url=config.get_url(),
require_min_connections=4)

View File

@ -20,6 +20,12 @@ def select_platform(plat):
return pytest.mark.skipif( return pytest.mark.skipif(
platform.system() != plat, reason=f"Only runs on {plat}") platform.system() != plat, reason=f"Only runs on {plat}")
def fips_enabled():
env_fips = os.getenv("COMPONENT_TESTS_FIPS")
return env_fips is not None and env_fips != "0"
nofips = pytest.mark.skipif(
fips_enabled(), reason=f"Only runs without FIPS (COMPONENT_TESTS_FIPS=0)")
def write_config(directory, config): def write_config(directory, config):
config_path = directory / "config.yml" config_path = directory / "config.yml"