diff options
Diffstat (limited to 'tests/cluster/cluster.tcl')
-rw-r--r-- | tests/cluster/cluster.tcl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/cluster/cluster.tcl b/tests/cluster/cluster.tcl index e86d70324..7b5f0f951 100644 --- a/tests/cluster/cluster.tcl +++ b/tests/cluster/cluster.tcl @@ -8,8 +8,9 @@ set ::cluster_master_nodes 0 set ::cluster_replica_nodes 0 -# Returns a parsed CLUSTER NODES output as a list of dictionaries. -proc get_cluster_nodes id { +# Returns a parsed CLUSTER NODES output as a list of dictionaries. Optional status field +# can be specified to only returns entries that match the provided status. +proc get_cluster_nodes {id {status "*"}} { set lines [split [R $id cluster nodes] "\r\n"] set nodes {} foreach l $lines { @@ -28,7 +29,9 @@ proc get_cluster_nodes id { linkstate [lindex $args 7] \ slots [lrange $args 8 end] \ ] - lappend nodes $node + if {[string match $status [lindex $args 7]]} { + lappend nodes $node + } } return $nodes } |