Skip to content

Commit

Permalink
Stabilize replica migration test to make sure cluster config is consi…
Browse files Browse the repository at this point in the history
…stent

CI report this failure:
```
[exception]: Executing test client: MOVED 1 127.0.0.1:22128.
MOVED 1 127.0.0.1:22128
    while executing
"wait_for_condition 1000 50 {
            [R 3 get key_991803] == 1024 && [R 3 get key_977613] == 10240 &&
            [R 4 get key_991803] == 1024 && ..."
```

This may be because, even though the cluster state becomes OK,
The cluster still has inconsistent configuration for a short period
of time. We make sure to wait for the config to be consistent.

Signed-off-by: Binbin <[email protected]>
  • Loading branch information
enjoy-binbin committed Nov 15, 2024
1 parent 86f33ea commit f138eda
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/unit/cluster/replica-migration.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ proc test_migrated_replica {type} {

# Wait for the cluster to be ok.
wait_for_condition 1000 50 {
[R 3 cluster slots] eq [R 4 cluster slots] &&
[R 4 cluster slots] eq [R 7 cluster slots] &&
[CI 3 cluster_state] eq "ok" &&
[CI 4 cluster_state] eq "ok" &&
[CI 7 cluster_state] eq "ok"
Expand Down Expand Up @@ -187,6 +189,7 @@ proc test_nonempty_replica {type} {

# Wait for the cluster to be ok.
wait_for_condition 1000 50 {
[R 4 cluster slots] eq [R 7 cluster slots] &&
[CI 4 cluster_state] eq "ok" &&
[CI 7 cluster_state] eq "ok"
} else {
Expand Down Expand Up @@ -306,6 +309,8 @@ proc test_sub_replica {type} {

# Wait for the cluster to be ok.
wait_for_condition 1000 50 {
[R 3 cluster slots] eq [R 4 cluster slots] &&
[R 4 cluster slots] eq [R 7 cluster slots] &&
[CI 3 cluster_state] eq "ok" &&
[CI 4 cluster_state] eq "ok" &&
[CI 7 cluster_state] eq "ok"
Expand Down

0 comments on commit f138eda

Please sign in to comment.