]> git.saurik.com Git - redis.git/blob - tests/integration/convert-zipmap-hash-on-load.tcl
Test that zipmap from RDB is correctly converted
[redis.git] / tests / integration / convert-zipmap-hash-on-load.tcl
1 set server_path [tmpdir "server.convert-zipmap-hash-on-load"]
2
3 # Copy RDB with zipmap encoded hash to server path
4 exec cp tests/assets/hash-zipmap.rdb $server_path
5
6 start_server [list overrides [list "dir" $server_path "dbfilename" "hash-zipmap.rdb"]] {
7 test "RDB load zipmap hash: converts to ziplist" {
8 r select 0
9
10 assert_match "*ziplist*" [r debug object hash]
11 assert_equal 2 [r hlen hash]
12 assert_match {v1 v2} [r hmget hash f1 f2]
13 }
14 }
15
16 start_server [list overrides [list "dir" $server_path "dbfilename" "hash-zipmap.rdb" "hash-max-ziplist-entries" 1]] {
17 test "RDB load zipmap hash: converts to hash table when hash-max-ziplist-entries is exceeded" {
18 r select 0
19
20 assert_match "*hashtable*" [r debug object hash]
21 assert_equal 2 [r hlen hash]
22 assert_match {v1 v2} [r hmget hash f1 f2]
23 }
24 }
25
26 start_server [list overrides [list "dir" $server_path "dbfilename" "hash-zipmap.rdb" "hash-max-ziplist-value" 1]] {
27 test "RDB load zipmap hash: converts to hash table when hash-max-ziplist-value is exceeded" {
28 r select 0
29
30 assert_match "*hashtable*" [r debug object hash]
31 assert_equal 2 [r hlen hash]
32 assert_match {v1 v2} [r hmget hash f1 f2]
33 }
34 }