diff --git a/component-tests/constants.py b/component-tests/constants.py index 0212017c..bb4b9d22 100644 --- a/component-tests/constants.py +++ b/component-tests/constants.py @@ -3,3 +3,7 @@ MAX_RETRIES = 5 BACKOFF_SECS = 7 PROXY_DNS_PORT = 9053 + + +def protocols(): + return ["h2mux", "http2", "quic"] diff --git a/component-tests/test_reconnect.py b/component-tests/test_reconnect.py index 02ad7ba2..0b601171 100644 --- a/component-tests/test_reconnect.py +++ b/component-tests/test_reconnect.py @@ -7,6 +7,7 @@ import pytest from flaky import flaky from conftest import CfdModes +from constants import protocols from util import start_cloudflared, wait_tunnel_ready, check_tunnel_not_connected @@ -18,9 +19,16 @@ class TestReconnect: "stdin-control": True, } + def _extra_config(self, protocol): + return { + "stdin-control": True, + "protocol": protocol, + } + @pytest.mark.skipif(platform.system() == "Windows", reason=f"Currently buggy on Windows TUN-4584") - def test_named_reconnect(self, tmp_path, component_tests_config): - config = component_tests_config(self.extra_config) + @pytest.mark.parametrize("protocol", protocols()) + def test_named_reconnect(self, tmp_path, component_tests_config, protocol): + config = component_tests_config(self._extra_config(protocol)) with start_cloudflared(tmp_path, config, new_process=True, allow_input=True, capture_output=False) as cloudflared: # Repeat the test multiple times because some issues only occur after multiple reconnects self.assert_reconnect(config, cloudflared, 5) diff --git a/component-tests/test_termination.py b/component-tests/test_termination.py index fbca69d0..ef12edc8 100644 --- a/component-tests/test_termination.py +++ b/component-tests/test_termination.py @@ -8,6 +8,7 @@ import time import pytest import requests +from constants import protocols from util import start_cloudflared, wait_tunnel_ready, check_tunnel_not_connected @@ -17,17 +18,21 @@ def supported_signals(): return [signal.SIGTERM, signal.SIGINT] -class TestTermination(): +class TestTermination: grace_period = 5 timeout = 10 - extra_config = { - "grace-period": f"{grace_period}s", - } sse_endpoint = "/sse?freq=1s" + def _extra_config(self, protocol): + return { + "grace-period": f"{self.grace_period}s", + "protocol": protocol, + } + @pytest.mark.parametrize("signal", supported_signals()) - def test_graceful_shutdown(self, tmp_path, component_tests_config, signal): - config = component_tests_config(self.extra_config) + @pytest.mark.parametrize("protocol", protocols()) + def test_graceful_shutdown(self, tmp_path, component_tests_config, signal, protocol): + config = component_tests_config(self._extra_config(protocol)) with start_cloudflared( tmp_path, config, new_process=True, capture_output=False) as cloudflared: wait_tunnel_ready(tunnel_url=config.get_url()) @@ -47,8 +52,9 @@ class TestTermination(): # test cloudflared terminates before grace period expires when all eyeball # connections are drained @pytest.mark.parametrize("signal", supported_signals()) - def test_shutdown_once_no_connection(self, tmp_path, component_tests_config, signal): - config = component_tests_config(self.extra_config) + @pytest.mark.parametrize("protocol", protocols()) + def test_shutdown_once_no_connection(self, tmp_path, component_tests_config, signal, protocol): + config = component_tests_config(self._extra_config(protocol)) with start_cloudflared( tmp_path, config, new_process=True, capture_output=False) as cloudflared: wait_tunnel_ready(tunnel_url=config.get_url()) @@ -66,8 +72,9 @@ class TestTermination(): self.wait_eyeball_thread(in_flight_req, self.grace_period) @pytest.mark.parametrize("signal", supported_signals()) - def test_no_connection_shutdown(self, tmp_path, component_tests_config, signal): - config = component_tests_config(self.extra_config) + @pytest.mark.parametrize("protocol", protocols()) + def test_no_connection_shutdown(self, tmp_path, component_tests_config, signal, protocol): + config = component_tests_config(self._extra_config(protocol)) with start_cloudflared( tmp_path, config, new_process=True, capture_output=False) as cloudflared: wait_tunnel_ready(tunnel_url=config.get_url())