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 2a0c57ac chore(tests): enhance the namespace replication to prevent
flaky test (#2540)
2a0c57ac is described below
commit 2a0c57ac7fc4499a210bc452884025a0010cb470
Author: hulk <[email protected]>
AuthorDate: Tue Sep 17 11:02:33 2024 +0800
chore(tests): enhance the namespace replication to prevent flaky test
(#2540)
---
tests/gocase/unit/namespace/namespace_test.go | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tests/gocase/unit/namespace/namespace_test.go
b/tests/gocase/unit/namespace/namespace_test.go
index ff11af84..e7615873 100644
--- a/tests/gocase/unit/namespace/namespace_test.go
+++ b/tests/gocase/unit/namespace/namespace_test.go
@@ -286,9 +286,10 @@ func TestNamespaceReplicateWithFullSync(t *testing.T) {
util.WaitForOffsetSync(t, masterClient, slaveClient, 60*time.Second)
// Namespaces should be replicated after the full sync
- token, err := slaveClient.Do(ctx, "NAMESPACE", "GET", "foo").Result()
- require.NoError(t, err)
- require.EqualValues(t, "bar", token)
+ require.Eventually(t, func() bool {
+ token, _ := slaveClient.Do(ctx, "NAMESPACE", "GET",
"foo").Val().(string)
+ return token == "bar"
+ }, 5*time.Second, 100*time.Millisecond)
}
func TestNamespaceRewrite(t *testing.T) {