convert-ziplist-zset-on-load.tcl 978 B

12345678910111213141516171819202122232425262728
  1. tags {"external:skip"} {
  2. # Copy RDB with ziplist encoded hash to server path
  3. set server_path [tmpdir "server.convert-ziplist-hash-on-load"]
  4. exec cp -f tests/assets/zset-ziplist.rdb $server_path
  5. start_server [list overrides [list "dir" $server_path "dbfilename" "zset-ziplist.rdb"]] {
  6. test "RDB load ziplist zset: converts to listpack when RDB loading" {
  7. r select 0
  8. assert_encoding listpack zset
  9. assert_equal 2 [r zcard zset]
  10. assert_match {one 1 two 2} [r zrange zset 0 -1 withscores]
  11. }
  12. }
  13. exec cp -f tests/assets/zset-ziplist.rdb $server_path
  14. start_server [list overrides [list "dir" $server_path "dbfilename" "zset-ziplist.rdb" "zset-max-ziplist-entries" 1]] {
  15. test "RDB load ziplist zset: converts to skiplist when zset-max-ziplist-entries is exceeded" {
  16. r select 0
  17. assert_encoding skiplist zset
  18. assert_equal 2 [r zcard zset]
  19. assert_match {one 1 two 2} [r zrange zset 0 -1 withscores]
  20. }
  21. }
  22. }