Skip to content

Commit d7fb18b

Browse files
committed
TUN-6810: Add component test for post-quantum
1 parent cbf8c71 commit d7fb18b

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

cfsetup.yaml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ stretch: &stretch
197197
component-test:
198198
build_dir: *build_dir
199199
builddeps:
200-
- *pinned_go_fips
200+
- *pinned_go
201201
- python3.7
202202
- python3-pip
203203
- python3-setuptools
@@ -206,14 +206,28 @@ stretch: &stretch
206206
- procps
207207
pre-cache-copy-paths:
208208
- component-tests/requirements.txt
209-
pre-cache:
209+
pre-cache: &component_test_pre_cache
210210
- sudo pip3 install --upgrade -r component-tests/requirements.txt
211-
post-cache:
211+
post-cache: &component_test_post_cache
212212
# Creates and routes a Named Tunnel for this build. Also constructs config file from env vars.
213213
- python3 component-tests/setup.py --type create
214214
- pytest component-tests -o log_cli=true --log-cli-level=INFO
215215
# The Named Tunnel is deleted and its route unprovisioned here.
216216
- python3 component-tests/setup.py --type cleanup
217+
component-test-fips:
218+
build_dir: *build_dir
219+
builddeps:
220+
- *pinned_go_fips
221+
- python3.7
222+
- python3-pip
223+
- python3-setuptools
224+
# procps installs the ps command which is needed in test_sysv_service because the init script
225+
# uses ps pid to determine if the agent is running
226+
- procps
227+
pre-cache-copy-paths:
228+
- component-tests/requirements.txt
229+
pre-cache: *component_test_pre_cache
230+
post-cache: *component_test_post_cache
217231
update-homebrew:
218232
builddeps:
219233
- openssh-client

component-tests/test_pq.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from util import LOGGER, nofips, start_cloudflared, wait_tunnel_ready
2+
3+
4+
@nofips
5+
class TestPostQuantum:
6+
def _extra_config(self):
7+
config = {
8+
"protocol": "quic",
9+
}
10+
return config
11+
12+
def test_post_quantum(self, tmp_path, component_tests_config):
13+
config = component_tests_config(self._extra_config())
14+
LOGGER.debug(config)
15+
with start_cloudflared(tmp_path, config, cfd_args=["run", "--post-quantum"], new_process=True):
16+
wait_tunnel_ready(tunnel_url=config.get_url(),
17+
require_min_connections=4)

component-tests/util.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ def select_platform(plat):
2020
return pytest.mark.skipif(
2121
platform.system() != plat, reason=f"Only runs on {plat}")
2222

23+
def fips_enabled():
24+
env_fips = os.getenv("COMPONENT_TESTS_FIPS")
25+
return env_fips is not None and env_fips != "0"
26+
27+
nofips = pytest.mark.skipif(
28+
fips_enabled(), reason=f"Only runs without FIPS (COMPONENT_TESTS_FIPS=0)")
2329

2430
def write_config(directory, config):
2531
config_path = directory / "config.yml"

0 commit comments

Comments
 (0)