test: add check for removing readonly replica (#4963)

This commit is contained in:
Borys 2025-04-20 12:51:56 +03:00 committed by GitHub
parent 2ca5bf1192
commit 707d7f0265
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3163,7 +3163,7 @@ async def test_readonly_replication(
await m1_node.client.execute_command("SET X 1")
logging.debug("start replication")
await r1_node.admin_client.execute_command(f"replicaof localhost {m1_node.instance.port}")
await r1_node.admin_client.execute_command(f"replicaof localhost {m1_node.instance.admin_port}")
await wait_available_async(r1_node.admin_client)
@ -3174,6 +3174,23 @@ async def test_readonly_replication(
# This behavior can be changed in the future
assert await r1_node.client.execute_command("GET Y") == None
m1_node.replicas = []
logging.debug("Push config without replica")
await push_config(
json.dumps(generate_config(master_nodes)), [node.admin_client for node in nodes]
)
with pytest.raises(redis.exceptions.ResponseError) as moved_error:
await r1_node.client.execute_command("GET X")
assert str(moved_error.value) == f"MOVED 7165 127.0.0.1:{instances[0].port}"
with pytest.raises(redis.exceptions.ResponseError) as moved_error:
await r1_node.client.execute_command("GET Y")
assert str(moved_error.value) == f"MOVED 3036 127.0.0.1:{instances[0].port}"
@dfly_args({"proactor_threads": 2, "cluster_mode": "yes"})
async def test_cancel_blocking_cmd_during_mygration_finalization(df_factory: DflyInstanceFactory):