Tangruilin commented on code in PR #3507:
URL: https://github.com/apache/kvrocks/pull/3507#discussion_r3395851735
##########
tests/gocase/unit/type/bitmap/bitmap_test.go:
##########
@@ -122,261 +125,313 @@ func SimulateBitOp(op BITOP, values ...[]byte) string {
func TestBitmap(t *testing.T) {
srv := util.StartServer(t, map[string]string{})
- defer srv.Close()
+ t.Cleanup(func() { srv.Close() })
ctx := context.Background()
rdb := srv.NewClient()
- defer func() { require.NoError(t, rdb.Close()) }()
+ t.Cleanup(func() { require.NoError(t, rdb.Close()) })
t.Run("GET bitmap string after setbit", func(t *testing.T) {
- require.NoError(t, rdb.SetBit(ctx, "b0", 0, 0).Err())
- require.NoError(t, rdb.SetBit(ctx, "b1", 35, 0).Err())
- Set2SetBit(t, rdb, ctx, "b2", []byte("\xac\x81\x32\x5d\xfe"))
- Set2SetBit(t, rdb, ctx, "b3", []byte("\xff\xff\xff\xff"))
- require.EqualValues(t, []string{"\x00", "\x00\x00\x00\x00\x00",
"\xac\x81\x32\x5d\xfe", "\xff\xff\xff\xff"}, GetBitmap(t, rdb, ctx, "b0", "b1",
"b2", "b3"))
+ t.Parallel()
+ p := util.KeyPrefix(t)
+ b0, b1, b2, b3 := p+"b0", p+"b1", p+"b2", p+"b3"
+ require.NoError(t, rdb.SetBit(ctx, b0, 0, 0).Err())
+ require.NoError(t, rdb.SetBit(ctx, b1, 35, 0).Err())
+ Set2SetBit(t, rdb, ctx, b2, []byte("\xac\x81\x32\x5d\xfe"))
+ Set2SetBit(t, rdb, ctx, b3, []byte("\xff\xff\xff\xff"))
+ require.EqualValues(t, []string{"\x00", "\x00\x00\x00\x00\x00",
"\xac\x81\x32\x5d\xfe", "\xff\xff\xff\xff"}, GetBitmap(t, rdb, ctx, b0, b1, b2,
b3))
})
t.Run("GET bitmap with out of max size", func(t *testing.T) {
+ t.Parallel()
+ p := util.KeyPrefix(t)
+ k := p + "b0"
require.NoError(t, rdb.Do(ctx, "config", "set",
"max-bitmap-to-string-mb", 1).Err())
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]