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 2024/02/17 13:39:35 UTC

(kvrocks) branch unstable updated: Fix flaky test cases in keyspace_test.go (#2104)

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 e8c05a38 Fix flaky test cases in keyspace_test.go (#2104)
e8c05a38 is described below

commit e8c05a38441c2bcdd82410f68b12b51af71e399d
Author: hulk <hu...@gmail.com>
AuthorDate: Sat Feb 17 21:39:31 2024 +0800

    Fix flaky test cases in keyspace_test.go (#2104)
    
    We expired a key with 1 second which is too short for testing the expiration time,
    because `Metadata::ExpireMsToS` function will use rounding to get a closer time value if
    METADATA_64BIT_ENCODING_MASK was disabled.
    
    This closes #2091
---
 tests/gocase/unit/keyspace/keyspace_test.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/gocase/unit/keyspace/keyspace_test.go b/tests/gocase/unit/keyspace/keyspace_test.go
index d60fb71f..704d4475 100644
--- a/tests/gocase/unit/keyspace/keyspace_test.go
+++ b/tests/gocase/unit/keyspace/keyspace_test.go
@@ -197,7 +197,7 @@ func TestKeyspace(t *testing.T) {
 	})
 
 	t.Run("Type a expired key", func(t *testing.T) {
-		expireTime := time.Second
+		expireTime := 2 * time.Second
 		key := "foo"
 		require.NoError(t, rdb.Del(ctx, key).Err())
 		require.Equal(t, "OK", rdb.SetEx(ctx, key, "bar", expireTime).Val())