From: John Mulligan Date: Tue, 21 Mar 2023 17:51:48 +0000 (-0400) Subject: mgr/cephadm: parametrize test for haproxy protocol support X-Git-Tag: v19.0.0~1098^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=23bcc7573a0cc6f01942a40dcf84a916545272d5;p=ceph.git mgr/cephadm: parametrize test for haproxy protocol support Make a few small tweaks to an existing test to validate that it functions similarly when the haxproxy protocol is disabled or enabled. Signed-off-by: John Mulligan --- diff --git a/src/pybind/mgr/cephadm/tests/test_services.py b/src/pybind/mgr/cephadm/tests/test_services.py index d33e6b09d9bc..f9817fb2fae4 100644 --- a/src/pybind/mgr/cephadm/tests/test_services.py +++ b/src/pybind/mgr/cephadm/tests/test_services.py @@ -1221,6 +1221,10 @@ class TestSNMPGateway: class TestIngressService: + @pytest.mark.parametrize( + "enable_haproxy_protocol", + [False, True], + ) @patch("cephadm.inventory.Inventory.get_addr") @patch("cephadm.utils.resolve_ip") @patch("cephadm.inventory.HostCache.get_daemons_by_service") @@ -1230,7 +1234,8 @@ class TestIngressService: _run_cephadm, _get_daemons_by_service, _resolve_ip, _get_addr, - cephadm_module: CephadmOrchestrator + cephadm_module: CephadmOrchestrator, + enable_haproxy_protocol: bool, ): _run_cephadm.side_effect = async_side_effect(('{}', '', 0)) @@ -1253,6 +1258,7 @@ class TestIngressService: count=1, hosts=['host1', 'host2']), port=12049, + enable_haproxy_protocol=enable_haproxy_protocol, ) ispec = IngressSpec( @@ -1265,6 +1271,7 @@ class TestIngressService: monitor_user='admin', monitor_password='12345', keepalived_password='12345', + enable_haproxy_protocol=enable_haproxy_protocol, ) cephadm_module.spec_store._specs = { @@ -1315,8 +1322,10 @@ class TestIngressService: ' mode tcp\n' ' balance source\n' ' hash-type consistent\n' - ' server nfs.foo.0 192.168.122.111:12049\n' ) + if enable_haproxy_protocol: + haproxy_txt += ' default-server send-proxy-v2\n' + haproxy_txt += ' server nfs.foo.0 192.168.122.111:12049\n' haproxy_expected_conf = { 'files': {'haproxy.cfg': haproxy_txt} }