From 9ca1e083d1e9d49cd049499e89cd33d202839bfb Mon Sep 17 00:00:00 2001 From: Akash Chandra Date: Thu, 9 Jan 2025 19:32:10 +0530 Subject: [PATCH] fix: TOOLS-2986 manage roster command fix manage roster command was broken due to error standardization The `unstable-cluster` string was changed `unstable cluster` which had to be handled. --- lib/live_cluster/client/constants.py | 2 +- lib/live_cluster/client/node.py | 4 ++-- test/unit/live_cluster/client/test_node.py | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/live_cluster/client/constants.py b/lib/live_cluster/client/constants.py index 9d24070a..ac9c221f 100644 --- a/lib/live_cluster/client/constants.py +++ b/lib/live_cluster/client/constants.py @@ -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" diff --git a/lib/live_cluster/client/node.py b/lib/live_cluster/client/node.py index 46f2abe4..c5ebac74 100644 --- a/lib/live_cluster/client/node.py +++ b/lib/live_cluster/client/node.py @@ -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 diff --git a/test/unit/live_cluster/client/test_node.py b/test/unit/live_cluster/client/test_node.py index f71b280c..32be4e39 100644 --- a/test/unit/live_cluster/client/test_node.py +++ b/test/unit/live_cluster/client/test_node.py @@ -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") @@ -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") @@ -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")