DEBUG RELOAD implemented, and test-redis.tcl modified to use it to check for persistence consistency.

This commit is contained in:
antirez
2009-11-24 21:44:20 +01:00
parent 1c0abf3c5d
commit 210e29f7d2
2 changed files with 51 additions and 1 deletions

View File

@ -235,6 +235,19 @@ proc main {server port} {
format $ok
} {2000}
test {Check if the list is still ok after a DEBUG RELOAD} {
$r debug reload
set ok 0
for {set i 0} {$i < 1000} {incr i} {
set rint [expr int(rand()*1000)]
if {[$r lindex mylist $rint] eq $rint} {incr ok}
if {[$r lindex mylist [expr (-$rint)-1]] eq [expr 999-$rint]} {
incr ok
}
}
format $ok
} {2000}
test {LLEN against non-list value error} {
$r del mylist
$r set mylist foobar
@ -551,6 +564,12 @@ proc main {server port} {
lsort [$r smembers setres]
} {995 996 997 998 999}
test {SINTERSTORE with two sets, after a DEBUG RELOAD} {
$r debug reload
$r sinterstore setres set1 set2
lsort [$r smembers setres]
} {995 996 997 998 999}
test {SUNIONSTORE with two sets} {
$r sunionstore setres set1 set2
lsort [$r smembers setres]
@ -906,6 +925,25 @@ proc main {server port} {
set _ $err
} {}
test {ZSCORE after a DEBUG RELOAD} {
set aux {}
set err {}
$r del zscoretest
for {set i 0} {$i < 1000} {incr i} {
set score [expr rand()]
lappend aux $score
$r zadd zscoretest $score $i
}
$r debug reload
for {set i 0} {$i < 1000} {incr i} {
if {[$r zscore zscoretest $i] != [lindex $aux $i]} {
set err "Expected score was [lindex $aux $i] but got [$r zscore zscoretest $i] for element $i"
break
}
}
set _ $err
} {}
test {ZRANGE and ZREVRANGE} {
list [$r zrange ztmp 0 -1] [$r zrevrange ztmp 0 -1]
} {{y x z} {z x y}}