From effcb5a03c4db7b4c892012ac1e79fc53f471d7e Mon Sep 17 00:00:00 2001 From: "debing.sun" Date: Wed, 1 Apr 2026 06:50:58 +0800 Subject: [PATCH] Fix flaky cluster pubsubshard test in 26-pubsubshard (#14962) In the "PUBSUB channels/shardchannels" test, we call sunsubscribe without channels, but the number of loops in consume_subscribe_messages() is determined by the size of channels. When channels are empty, the loop will loop 0 times and will not read the sunsubscribe response message returned by the server. This means that when verifying the channel length, the previous command might not have been complete yet, so this PR added a read after sunsubscribe. --- tests/cluster/tests/26-pubsubshard.tcl | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/cluster/tests/26-pubsubshard.tcl b/tests/cluster/tests/26-pubsubshard.tcl index 34939acf7..6c3ee14ae 100644 --- a/tests/cluster/tests/26-pubsubshard.tcl +++ b/tests/cluster/tests/26-pubsubshard.tcl @@ -123,6 +123,7 @@ test "PUBSUB channels/shardchannels" { assert_equal {3} [llength [$publishclient pubsub shardchannels]] sunsubscribe $subscribeclient + $subscribeclient read set channel_list [$publishclient pubsub shardchannels] assert_equal {2} [llength $channel_list] assert {[lsearch -exact $channel_list "\{channel.0\}2"] >= 0}