This is an automated email from the ASF dual-hosted git repository.

hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new cc2af38b Fix flaky test failure in TestSlotMigrateSync (#1680)
cc2af38b is described below

commit cc2af38b03a46b6634ee3c3815668c3e343165cd
Author: hulk <[email protected]>
AuthorDate: Fri Aug 18 23:03:25 2023 +0800

    Fix flaky test failure in TestSlotMigrateSync (#1680)
---
 tests/gocase/integration/slotmigrate/slotmigrate_test.go | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/gocase/integration/slotmigrate/slotmigrate_test.go 
b/tests/gocase/integration/slotmigrate/slotmigrate_test.go
index 11b32fc7..ed990ae3 100644
--- a/tests/gocase/integration/slotmigrate/slotmigrate_test.go
+++ b/tests/gocase/integration/slotmigrate/slotmigrate_test.go
@@ -473,9 +473,12 @@ func TestSlotMigrateSync(t *testing.T) {
                validTimeouts := []int{0, 10, 20, 30}
                for _, timeout := range validTimeouts {
                        slot++
-                       result := rdb0.Do(ctx, "clusterx", "migrate", slot, 
id1, "sync", timeout)
-                       require.NoError(t, result.Err(), "with timeout: %v", 
timeout)
-                       require.Equal(t, "OK", result.Val(), "with timeout: 
%d", timeout)
+                       err := rdb0.Do(ctx, "clusterx", "migrate", slot, id1, 
"sync", timeout).Err()
+                       // go-redis will auto-retry if occurs timeout error, so 
it may return the already migrated slot error,
+                       // so we just allow this error here to prevent the 
flaky test failure.
+                       if err != nil && !strings.Contains(err.Error(), "ERR 
There is already a migrating slot") {
+                               require.NoError(t, err)
+                       }
                }
        })
 

Reply via email to