From 6b922b2748a7cb74f6a1885d1f61a76c2301ec8f Mon Sep 17 00:00:00 2001 From: Alexander Indenbaum Date: Fri, 2 Feb 2024 22:10:05 +0200 Subject: [PATCH] Tweak tests Signed-off-by: Alexander Indenbaum --- control/grpc.py | 2 +- tests/test_cli.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/control/grpc.py b/control/grpc.py index 637cd9dc9..307a1342c 100644 --- a/control/grpc.py +++ b/control/grpc.py @@ -1731,7 +1731,7 @@ def create_listener_safe(self, request, context): self.logger.error(create_listener_error_prefix) return pb2.req_status(status=errno.EINVAL, error_message=create_listener_error_prefix) - enable_ha = request.nqn in self.subsys_ha and self.subsys_ha[request.nqn] + enable_ha = self.get_subsystem_ha_status() if enable_ha: for x in range (MAX_ANA_GROUPS): diff --git a/tests/test_cli.py b/tests/test_cli.py index 0322a21b2..c813ca4f0 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -516,6 +516,7 @@ def test_add_host_invalid_nqn(self, caplog): def test_create_listener(self, caplog, listener, gateway): caplog.clear() cli(["listener", "add", "--subsystem", subsystem] + listener) + assert "enable_ha: False" in caplog.text assert "ipv4" in caplog.text.lower() assert f"Adding {subsystem} listener at {listener[3]}:{listener[5]}: Successful" in caplog.text @@ -524,6 +525,7 @@ def test_create_listener(self, caplog, listener, gateway): def test_create_listener_ipv6(self, caplog, listener_ipv6, gateway): caplog.clear() cli(["--server-address", server_addr_ipv6, "listener", "add", "--subsystem", subsystem] + listener_ipv6) + assert "enable_ha: False" in caplog.text assert "ipv6" in caplog.text.lower() assert f"Adding {subsystem} listener at [{listener_ipv6[3]}]:{listener_ipv6[5]}: Successful" in caplog.text @@ -531,6 +533,7 @@ def test_create_listener_ipv6(self, caplog, listener_ipv6, gateway): def test_create_listener_no_port(self, caplog, listener, gateway): caplog.clear() cli(["listener", "add", "--subsystem", subsystem] + listener) + assert "enable_ha: False" in caplog.text assert "ipv4" in caplog.text.lower() assert f"Adding {subsystem} listener at {listener[3]}:4420: Successful" in caplog.text @@ -729,6 +732,7 @@ def test_change_namespace_lb_group(self, caplog, gateway): def test_create_listener_ana(self, caplog, listener, gateway): caplog.clear() cli(["listener", "add", "--subsystem", subsystem] + listener) + assert "enable_ha: True" in caplog.text assert "ipv4" in caplog.text.lower() assert f"Adding {subsystem} listener at {listener[3]}:{listener[5]}: Successful" in caplog.text