Skip to content

Commit 5c9be0e

Browse files
committed
Wrap the logic into a single expression
Signed-off-by: Hanxi Zhang <hanxizh@amazon.com>
1 parent 8502965 commit 5c9be0e

2 files changed

Lines changed: 9 additions & 17 deletions

File tree

tests/unit/cluster/cli.tcl

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,17 +296,13 @@ test {Migrate the last slot away from a node using valkey-cli} {
296296
set owner_id [$owner_r CLUSTER MYID]
297297

298298
# Wait until owner node knows the new node
299-
wait_for_condition 1000 50 [list {
300-
set nodes [get_cluster_nodes $owner_id]
299+
wait_for_condition 1000 50 {
301300
set found 0
302-
foreach n $nodes {
303-
if {[dict get $n id] eq $newnode_id} {
304-
set found 1
305-
break
306-
}
301+
foreach n [get_cluster_nodes $owner_id] {
302+
if {[dict get $n id] eq $newnode_id} { set found 1; break }
307303
}
308304
$found
309-
}] else {
305+
} else {
310306
fail "Owner node does not know the new node yet"
311307
}
312308

tests/unit/cluster/test-flaky-migrate-slots.tcl

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,13 @@ test {Migrate the last slot away from a node using valkey-cli} {
5050
set owner_id [$owner_r CLUSTER MYID]
5151

5252
# Wait until owner node knows the new node
53-
wait_for_condition 1000 50 [list {
54-
set nodes [get_cluster_nodes $owner_id]
53+
wait_for_condition 1000 50 {
5554
set found 0
56-
foreach n $nodes {
57-
if {[dict get $n id] eq $newnode_id} {
58-
set found 1
59-
break
60-
}
55+
foreach n [get_cluster_nodes $owner_id] {
56+
if {[dict get $n id] eq $newnode_id} { set found 1; break }
6157
}
6258
$found
63-
}] else {
59+
} else {
6460
fail "Owner node does not know the new node yet"
6561
}
6662

@@ -114,4 +110,4 @@ test {Migrate the last slot away from a node using valkey-cli} {
114110
wait_for_cluster_propagation
115111
assert_match *master* [$owner_r role]
116112
}
117-
}
113+
}

0 commit comments

Comments
 (0)