mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
use DEBUG DIGEST in new test suite
This commit is contained in:
parent
98578b5704
commit
35453d992f
@ -156,45 +156,3 @@ proc createComplexDataset {r ops} {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc datasetDigest r {
|
||||
set keys [lsort [$r keys *]]
|
||||
set digest {}
|
||||
foreach k $keys {
|
||||
set t [$r type $k]
|
||||
switch $t {
|
||||
{string} {
|
||||
set aux [::sha1::sha1 -hex [$r get $k]]
|
||||
} {list} {
|
||||
if {[$r llen $k] == 0} {
|
||||
set aux {}
|
||||
} else {
|
||||
set aux [::sha1::sha1 -hex [$r lrange $k 0 -1]]
|
||||
}
|
||||
} {set} {
|
||||
if {[$r scard $k] == 0} {
|
||||
set aux {}
|
||||
} else {
|
||||
set aux [::sha1::sha1 -hex [lsort [$r smembers $k]]]
|
||||
}
|
||||
} {zset} {
|
||||
if {[$r zcard $k] == 0} {
|
||||
set aux {}
|
||||
} else {
|
||||
set aux [::sha1::sha1 -hex [$r zrange $k 0 -1 withscores]]
|
||||
}
|
||||
} {hash} {
|
||||
if {[$r hlen $k] == 0} {
|
||||
set aux {}
|
||||
} else {
|
||||
set aux [::sha1::sha1 -hex [lsort [$r hgetall $k]]]
|
||||
}
|
||||
} default {
|
||||
error "Type not supported: $t"
|
||||
}
|
||||
}
|
||||
if {$aux eq {}} continue
|
||||
set digest [::sha1::sha1 -hex [join [list $aux $digest $k] "\n"]]
|
||||
}
|
||||
return $digest
|
||||
}
|
||||
|
@ -48,9 +48,9 @@ start_server default.conf {} {
|
||||
test {Check consistency of different data types after a reload} {
|
||||
r flushdb
|
||||
createComplexDataset r 10000
|
||||
set sha1 [datasetDigest r]
|
||||
set sha1 [r debug digest]
|
||||
r debug reload
|
||||
set sha1_after [datasetDigest r]
|
||||
set sha1_after [r debug digest]
|
||||
expr {$sha1 eq $sha1_after}
|
||||
} {1}
|
||||
|
||||
@ -58,7 +58,7 @@ start_server default.conf {} {
|
||||
r bgrewriteaof
|
||||
waitForBgrewriteaof r
|
||||
r debug loadaof
|
||||
set sha1_after [datasetDigest r]
|
||||
set sha1_after [r debug digest]
|
||||
expr {$sha1 eq $sha1_after}
|
||||
} {1}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user