You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by hu...@apache.org on 2025/09/26 05:28:31 UTC

(kvrocks) branch unstable updated: fix(tests): flaky test cases due to the command execution order in WAIT command (#3200)

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 b97b3ec6e fix(tests): flaky test cases due to the command execution order in WAIT command (#3200)
b97b3ec6e is described below

commit b97b3ec6eadd9cdd18747fc245164ea79a441fee
Author: hulk <hu...@gmail.com>
AuthorDate: Fri Sep 26 13:28:25 2025 +0800

    fix(tests): flaky test cases due to the command execution order in WAIT command (#3200)
    
    This closes #3197.
---
 tests/gocase/unit/wait/wait_test.go | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/gocase/unit/wait/wait_test.go b/tests/gocase/unit/wait/wait_test.go
index f66fe6d95..bd86ad335 100644
--- a/tests/gocase/unit/wait/wait_test.go
+++ b/tests/gocase/unit/wait/wait_test.go
@@ -186,7 +186,7 @@ func TestWaitCommand(t *testing.T) {
 		select {
 		case <-done:
 			// Success - command completed after replica connected
-		case <-time.After(5 * time.Second):
+		case <-time.After(15 * time.Second):
 			t.Fatal("WAIT command did not complete after replica connected")
 		}
 	})
@@ -219,7 +219,7 @@ func TestWaitCommand(t *testing.T) {
 		select {
 		case <-done:
 			// Success - command not blocked
-		case <-time.After(5 * time.Second):
+		case <-time.After(15 * time.Second):
 			t.Fatal("WAIT command did not timeout")
 		}
 
@@ -276,7 +276,9 @@ func TestWaitBlockExecutingCommand(t *testing.T) {
 	util.WaitForOffsetSync(t, masterRdb, slaveRdb, 5*time.Second)
 
 	// the remaining command should be executed after replication
-	require.Equal(t, "v3", masterRdb.Get(context.Background(), "k1").Val())
+	require.Eventually(t, func() bool {
+		return slaveRdb.Get(context.Background(), "k1").Val() == "v3"
+	}, 5*time.Second, 100*time.Millisecond)
 }
 
 // if a command is blocked by WAIT, it should continue to execute after the WAIT command is completed.