1 start_server
{tags
{"other"}} {
2 if {$::force_failure} {
3 # This is used just for test suite development purposes.
9 test
{SAVE
- make sure there are all the types as values
} {
10 # Wait for a background saving in progress to terminate
12 r lpush mysavelist hello
13 r lpush mysavelist world
15 r
set mynormalkey
{blablablba
}
16 r zadd mytestzset
10 a
17 r zadd mytestzset
20 b
18 r zadd mytestzset
30 c
23 if {$::accurate} {set iterations
10000} else {set iterations
1000}
24 foreach fuzztype
{binary alpha compr
} {
25 test
"FUZZ stresser with data model $fuzztype" {
27 for {set i
0} {$i < $iterations} {incr i
} {
28 set fuzz
[randstring
0 512 $fuzztype]
32 set err
[list $fuzz $got]
52 test
{SELECT an out of range DB
} {
53 catch {r select
1000000} err
58 if {![catch {package require sha1
}]} {
59 if {$::accurate} {set numops
10000} else {set numops
1000}
60 test
{Check consistency of different data types
after a reload
} {
62 createComplexDataset r
$numops
64 set sha1
[r debug digest
]
66 set sha1_after
[r debug digest
]
67 if {$sha1 eq
$sha1_after} {
70 set newdump
[csvdump r
]
71 puts "Consistency test failed!"
72 puts "You can inspect the two dumps in /tmp/repldump*.txt"
74 set fd
[open /tmp
/repldump1.txt w
]
77 set fd
[open /tmp
/repldump2.txt w
]
85 test
{Same dataset digest
if saving
/reloading as AOF?
} {
89 set sha1_after
[r debug digest
]
90 if {$sha1 eq
$sha1_after} {
93 set newdump
[csvdump r
]
94 puts "Consistency test failed!"
95 puts "You can inspect the two dumps in /tmp/aofdump*.txt"
97 set fd
[open /tmp
/aofdump1.txt w
]
100 set fd
[open /tmp
/aofdump2.txt w
]
110 test
{EXPIRES
after a reload
(snapshot
+ append only
file)} {
117 set e1
[expr {$ttl > 900 && $ttl <= 1000}]
119 waitForBgrewriteaof r
122 set e2
[expr {$ttl > 900 && $ttl <= 1000}]
127 test
{PIPELINING stresser
(also a regression
for the old epoll bug
)} {
128 set fd2
[socket $::host $::port]
129 fconfigure $fd2 -encoding binary -translation binary
130 puts -nonewline $fd2 "SELECT 9\r\n"
134 for {set i
0} {$i < 100000} {incr i
} {
136 set val
"0000${i}0000"
137 append q
"SET key:$i $val\r\n"
138 puts -nonewline $fd2 $q
140 append q
"GET key:$i\r\n"
141 puts -nonewline $fd2 $q
145 for {set i
0} {$i < 100000} {incr i
} {
148 set count
[string range
$count 1 end
]
149 set val
[read $fd2 $count]
157 test
{MUTLI
/ EXEC basics
} {
163 set v1
[r
lrange mylist
0 -1]
167 } {QUEUED QUEUED
{{a b c
} PONG
}}
175 set v1
[r del mylist
]
177 set v3
[r
lrange mylist
0 -1]
179 } {QUEUED OK
{a b c
}}
181 test
{Nested MULTI are not allowed
} {
184 catch {[r multi
]} err
189 test
{MULTI where commands alter argc
/argv
} {
193 list [r
exec] [r exists myset
]
196 test
{WATCH inside MULTI is not allowed
} {
199 catch {[r watch x
]} err
204 test
{APPEND basics
} {
205 list [r
append foo bar
] [r get foo
] \
206 [r
append foo
100] [r get foo
]
209 test
{APPEND basics
, integer encoded values
} {
214 lappend res
[r get foo
]
217 lappend res
[r get foo
]
220 test
{APPEND fuzzing
} {
222 foreach type
{binary alpha compr
} {
225 for {set i
0} {$i < 1000} {incr i
} {
226 set bin
[randstring
0 10 $type]
230 if {$buf != [r get x
]} {
231 set err
"Expected '$buf' found '[r get x]'"
238 # Leave the user with a clean DB before to exit
243 lappend aux
[r dbsize
]
246 lappend aux
[r dbsize
]
249 test
{Perform a final SAVE to leave a clean DB on disk
} {