Skip to content

Commit b3ab42a

Browse files
committed
Reverted change in test_auth: we'll replace the default node only for commands we allow to retry on
1 parent f8060b7 commit b3ab42a

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

redis/cluster.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,10 +1057,10 @@ def execute_command(self, *args, **kwargs):
10571057
# Return the processed result
10581058
return self._process_result(args[0], res, **kwargs)
10591059
except Exception as e:
1060-
if is_default_node:
1061-
# Replace the default cluster node
1062-
self.replace_default_node()
10631060
if retry_attempts > 0 and type(e) in self.__class__.ERRORS_ALLOW_RETRY:
1061+
if is_default_node:
1062+
# Replace the default cluster node
1063+
self.replace_default_node()
10641064
# The nodes and slots cache were reinitialized.
10651065
# Try again with the new cluster setup.
10661066
retry_attempts -= 1

tests/test_asyncio/test_cluster.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,6 @@ async def test_default_node_is_replaced_after_exception(self, r):
800800
# CLUSTER NODES command is being executed on the default node
801801
nodes = await r.cluster_nodes()
802802
assert "myself" in nodes.get(curr_default_node.name).get("flags")
803-
804803
# Mock connection error for the default node
805804
mock_node_resp_exc(curr_default_node, ConnectionError("error"))
806805
# Test that the command succeed from a different node

tests/test_cluster.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,6 @@ def raise_connection_error():
813813
nodes = r.cluster_nodes()
814814
assert "myself" not in nodes.get(curr_default_node.name).get("flags")
815815
assert r.get_default_node() != curr_default_node
816-
# Rollback to the old default node
817-
r.replace_default_node(curr_default_node)
818816

819817

820818
@pytest.mark.onlycluster

0 commit comments

Comments
 (0)