Skip to content

Commit

Permalink
Tweak tests
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Indenbaum <[email protected]>
  • Loading branch information
Alexander Indenbaum committed Feb 2, 2024
1 parent a2b023f commit 6b922b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion control/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -524,13 +525,15 @@ 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

@pytest.mark.parametrize("listener", listener_list_no_port)
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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 6b922b2

Please sign in to comment.