Skip to content

Commit

Permalink
fix: TOOLS-2986 manage roster command fix
Browse files Browse the repository at this point in the history
manage roster command was broken due to error standardization

The `unstable-cluster` string was changed `unstable cluster` which had to be handled.
  • Loading branch information
a-spiker committed Jan 9, 2025
1 parent d95f7c5 commit 9ca1e08
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/live_cluster/client/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ErrorsMsgs:
DC_NODE_ADD_FAIL = "Failed to add node to XDR datacenter"
DC_NODE_REMOVE_FAIL = "Failed to remove node from XDR datacenter"
INVALID_REWIND = 'Invalid rewind. Must be int or "all"'
UNABLE_TO_DETERMINE_CLUSTER_STABILITY = "Failed to check cluster stability"
INFO_SERVER_ERROR_RESPONSE = 'Failed to execute info command - server error'


DEFAULT_CONFIG_PATH = "/etc/aerospike/aerospike.conf"
4 changes: 2 additions & 2 deletions lib/live_cluster/client/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -2401,11 +2401,11 @@ async def info_cluster_stable(
resp = await self._info(req)

if "error" in resp.lower():
if "cluster-not-specified-size" in resp or "unstable-cluster" in resp:
if "cluster not specified size" in resp or "unstable cluster" in resp:
raise ASInfoClusterStableError(resp)

raise ASInfoResponseError(
ErrorsMsgs.UNABLE_TO_DETERMINE_CLUSTER_STABILITY, resp
ErrorsMsgs.INFO_SERVER_ERROR_RESPONSE, resp
)

return resp
Expand Down
10 changes: 5 additions & 5 deletions test/unit/live_cluster/client/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -2052,8 +2052,8 @@ async def test_info_cluster_stable(self):
)

async def test_info_cluster_stable_with_errors(self):
self.info_mock.return_value = "ERROR::cluster-not-specified-size"
expected = ASInfoClusterStableError("ERROR::cluster-not-specified-size")
self.info_mock.return_value = "ERROR::cluster not specified size"
expected = ASInfoClusterStableError("ERROR::cluster not specified size")

actual = await self.node.info_cluster_stable(cluster_size=3, namespace="bar")

Expand All @@ -2066,8 +2066,8 @@ async def test_info_cluster_stable_with_errors(self):
"info_cluster_stable did not return the expected result",
)

self.info_mock.return_value = "ERROR::unstable-cluster"
expected = ASInfoClusterStableError("ERROR::unstable-cluster")
self.info_mock.return_value = "ERROR::unstable cluster"
expected = ASInfoClusterStableError("ERROR::unstable cluster")

actual = await self.node.info_cluster_stable(cluster_size=3, namespace="bar")

Expand All @@ -2082,7 +2082,7 @@ async def test_info_cluster_stable_with_errors(self):

self.info_mock.return_value = "ERROR::foo"
expected = ASInfoResponseError(
"Failed to check cluster stability", "ERROR::foo"
"Failed to execute info command - server error", "ERROR::foo"
)

actual = await self.node.info_cluster_stable(namespace="bar")
Expand Down

0 comments on commit 9ca1e08

Please sign in to comment.