From 5facf1283606732a6cb7afdc4b97a52ad367fd2f Mon Sep 17 00:00:00 2001 From: mkaruza Date: Fri, 14 Mar 2025 16:01:30 +0100 Subject: [PATCH] fix(test): Execute SSUBSCRIBE command directly in client (#4763) Using `pubsub.ssubscribe` function doesn't wait for any response from server. Fixed by switching to execute SSUBSCRIBE commands in client directly. Signed-off-by: mkaruza --- tests/dragonfly/cluster_test.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/dragonfly/cluster_test.py b/tests/dragonfly/cluster_test.py index 65c9c3010..313b4200d 100644 --- a/tests/dragonfly/cluster_test.py +++ b/tests/dragonfly/cluster_test.py @@ -3000,14 +3000,10 @@ async def test_cluster_sharded_pubsub_shard_commands(df_factory: DflyInstanceFac await push_config(json.dumps(generate_config(nodes_info)), [node.client for node in nodes_info]) - node_a = ClusterNode("localhost", nodes[0].port) - node_b = ClusterNode("localhost", nodes[1].port) - - consumer_client = RedisCluster(startup_nodes=[node_a, node_b]) - consumer = consumer_client.pubsub() - - consumer.ssubscribe("pubsub-shard-channel") - consumer.ssubscribe("shard-channel") + # We are executing SSUBSCRIBE commands and wait for them to be sure that + # channels are created + message = await c_nodes[0].execute_command("SSUBSCRIBE pubsub-shard-channel") + message = await c_nodes[0].execute_command("SSUBSCRIBE shard-channel") message = await c_nodes[0].execute_command("PUBSUB SHARDCHANNELS") message.sort()