1 start_server
{tags
{"other"}} {
2 test
{SAVE
- make sure there are all the types as values
} {
3 # Wait for a background saving in progress to terminate
5 r lpush mysavelist hello
6 r lpush mysavelist world
8 r
set mynormalkey
{blablablba
}
10 r zadd mytestzset
20 b
11 r zadd mytestzset
30 c
16 foreach fuzztype
{binary alpha compr
} {
17 test
"FUZZ stresser with data model $fuzztype" {
19 for {set i
0} {$i < 10000} {incr i
} {
20 set fuzz
[randstring
0 512 $fuzztype]
24 set err
[list $fuzz $got]
44 test
{SELECT an out of range DB
} {
45 catch {r select
1000000} err
50 if {![catch {package require sha1
}]} {
51 test
{Check consistency of different data types
after a reload
} {
53 createComplexDataset r
10000
55 set sha1
[r debug digest
]
57 set sha1_after
[r debug digest
]
58 if {$sha1 eq
$sha1_after} {
61 set newdump
[csvdump r
]
62 puts "Consistency test failed!"
63 puts "You can inspect the two dumps in /tmp/repldump*.txt"
65 set fd
[open /tmp
/repldump1.txt w
]
68 set fd
[open /tmp
/repldump2.txt w
]
76 test
{Same dataset digest
if saving
/reloading as AOF?
} {
80 set sha1_after
[r debug digest
]
81 if {$sha1 eq
$sha1_after} {
84 set newdump
[csvdump r
]
85 puts "Consistency test failed!"
86 puts "You can inspect the two dumps in /tmp/aofdump*.txt"
88 set fd
[open /tmp
/aofdump1.txt w
]
91 set fd
[open /tmp
/aofdump2.txt w
]
101 test
{EXPIRES
after a reload
(snapshot
+ append only
file)} {
108 set e1
[expr {$ttl > 900 && $ttl <= 1000}]
110 waitForBgrewriteaof r
112 set e2
[expr {$ttl > 900 && $ttl <= 1000}]
116 test
{PIPELINING stresser
(also a regression
for the old epoll bug
)} {
117 set fd2
[socket $::host $::port]
118 fconfigure $fd2 -encoding binary -translation binary
119 puts -nonewline $fd2 "SELECT 9\r\n"
123 for {set i
0} {$i < 100000} {incr i
} {
125 set val
"0000${i}0000"
126 append q
"SET key:$i $val\r\n"
127 puts -nonewline $fd2 $q
129 append q
"GET key:$i\r\n"
130 puts -nonewline $fd2 $q
134 for {set i
0} {$i < 100000} {incr i
} {
137 set count
[string range
$count 1 end
]
138 set val
[read $fd2 $count]
145 test
{MUTLI
/ EXEC basics
} {
151 set v1
[r
lrange mylist
0 -1]
155 } {QUEUED QUEUED
{{a b c
} PONG
}}
163 set v1
[r del mylist
]
165 set v3
[r
lrange mylist
0 -1]
167 } {QUEUED OK
{a b c
}}
169 test
{Nested MULTI are not allowed
} {
172 catch {[r multi
]} err
177 test
{WATCH inside MULTI is not allowed
} {
180 catch {[r watch x
]} err
185 test
{APPEND basics
} {
186 list [r
append foo bar
] [r get foo
] \
187 [r
append foo
100] [r get foo
]
190 test
{APPEND basics
, integer encoded values
} {
195 lappend res
[r get foo
]
198 lappend res
[r get foo
]
201 test
{APPEND fuzzing
} {
203 foreach type
{binary alpha compr
} {
206 for {set i
0} {$i < 1000} {incr i
} {
207 set bin
[randstring
0 10 $type]
211 if {$buf != [r get x
]} {
212 set err
"Expected '$buf' found '[r get x]'"
219 # Leave the user with a clean DB before to exit
224 lappend aux
[r dbsize
]
227 lappend aux
[r dbsize
]
230 test
{Perform a final SAVE to leave a clean DB on disk
} {