summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2012-01-25 13:26:25 -0800
committerPieter Noordhuis <pcnoordhuis@gmail.com>2012-01-25 13:28:11 -0800
commit80586cb894da69a26f6ab52d6bad0e9e8fa8a6bd (patch)
tree7d68a24c57c3ea0ad44870d15cce253b591add62 /tests/integration
parentfe458402014cdd98a10179c85899f1eca0307534 (diff)
downloadredis-80586cb894da69a26f6ab52d6bad0e9e8fa8a6bd.tar.gz
Test that zipmap from RDB is correctly converted
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/convert-zipmap-hash-on-load.tcl34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/integration/convert-zipmap-hash-on-load.tcl b/tests/integration/convert-zipmap-hash-on-load.tcl
new file mode 100644
index 000000000..75a65d3e8
--- /dev/null
+++ b/tests/integration/convert-zipmap-hash-on-load.tcl
@@ -0,0 +1,34 @@
+set server_path [tmpdir "server.convert-zipmap-hash-on-load"]
+
+# Copy RDB with zipmap encoded hash to server path
+exec cp tests/assets/hash-zipmap.rdb $server_path
+
+start_server [list overrides [list "dir" $server_path "dbfilename" "hash-zipmap.rdb"]] {
+ test "RDB load zipmap hash: converts to ziplist" {
+ r select 0
+
+ assert_match "*ziplist*" [r debug object hash]
+ assert_equal 2 [r hlen hash]
+ assert_match {v1 v2} [r hmget hash f1 f2]
+ }
+}
+
+start_server [list overrides [list "dir" $server_path "dbfilename" "hash-zipmap.rdb" "hash-max-ziplist-entries" 1]] {
+ test "RDB load zipmap hash: converts to hash table when hash-max-ziplist-entries is exceeded" {
+ r select 0
+
+ assert_match "*hashtable*" [r debug object hash]
+ assert_equal 2 [r hlen hash]
+ assert_match {v1 v2} [r hmget hash f1 f2]
+ }
+}
+
+start_server [list overrides [list "dir" $server_path "dbfilename" "hash-zipmap.rdb" "hash-max-ziplist-value" 1]] {
+ test "RDB load zipmap hash: converts to hash table when hash-max-ziplist-value is exceeded" {
+ r select 0
+
+ assert_match "*hashtable*" [r debug object hash]
+ assert_equal 2 [r hlen hash]
+ assert_match {v1 v2} [r hmget hash f1 f2]
+ }
+}