summaryrefslogtreecommitdiffstats
path: root/tests/integration/convert-ziplist-zset-on-load.tcl
blob: 0fbb20138b501639ac33043d5f7505aaee1cdb1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
tags {"external:skip"} {

# Copy RDB with ziplist encoded hash to server path
set server_path [tmpdir "server.convert-ziplist-hash-on-load"]

exec cp -f tests/assets/zset-ziplist.rdb $server_path
start_server [list overrides [list "dir" $server_path "dbfilename" "zset-ziplist.rdb"]] {
    test "RDB load ziplist zset: converts to listpack when RDB loading" {
        r select 0

        assert_encoding listpack zset
        assert_equal 2 [r zcard zset]
        assert_match {one 1 two 2} [r zrange zset 0 -1 withscores]
    }
}

exec cp -f tests/assets/zset-ziplist.rdb $server_path
start_server [list overrides [list "dir" $server_path "dbfilename" "zset-ziplist.rdb" "zset-max-ziplist-entries" 1]] {
    test "RDB load ziplist zset: converts to skiplist when zset-max-ziplist-entries is exceeded" {
        r select 0

        assert_encoding skiplist zset
        assert_equal 2 [r zcard zset]
        assert_match {one 1 two 2} [r zrange zset 0 -1 withscores]
    }
}

}