File: convert-ziplist-zset-on-load.tcl

package info (click to toggle)
redis 5%3A8.0.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 22,304 kB
  • sloc: ansic: 216,903; tcl: 51,562; sh: 4,625; perl: 4,214; cpp: 3,568; python: 2,954; makefile: 2,055; ruby: 639; javascript: 30; csh: 7
file content (28 lines) | stat: -rw-r--r-- 978 bytes parent folder | download | duplicates (5)
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]
    }
}

}