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
113 set e2
[expr {$ttl > 900 && $ttl <= 1000}]
118 test
{PIPELINING stresser
(also a regression
for the old epoll bug
)} {
119 set fd2
[socket $::host $::port]
120 fconfigure $fd2 -encoding binary -translation binary
121 puts -nonewline $fd2 "SELECT 9\r\n"
125 for {set i
0} {$i < 100000} {incr i
} {
127 set val
"0000${i}0000"
128 append q
"SET key:$i $val\r\n"
129 puts -nonewline $fd2 $q
131 append q
"GET key:$i\r\n"
132 puts -nonewline $fd2 $q
136 for {set i
0} {$i < 100000} {incr i
} {
139 set count
[string range
$count 1 end
]
140 set val
[read $fd2 $count]
148 test
{MUTLI
/ EXEC basics
} {
154 set v1
[r
lrange mylist
0 -1]
158 } {QUEUED QUEUED
{{a b c
} PONG
}}
166 set v1
[r del mylist
]
168 set v3
[r
lrange mylist
0 -1]
170 } {QUEUED OK
{a b c
}}
172 test
{Nested MULTI are not allowed
} {
175 catch {[r multi
]} err
180 test
{MULTI where commands alter argc
/argv
} {
184 list [r
exec] [r exists myset
]
187 test
{WATCH inside MULTI is not allowed
} {
190 catch {[r watch x
]} err
195 test
{APPEND basics
} {
196 list [r
append foo bar
] [r get foo
] \
197 [r
append foo
100] [r get foo
]
200 test
{APPEND basics
, integer encoded values
} {
205 lappend res
[r get foo
]
208 lappend res
[r get foo
]
211 test
{APPEND fuzzing
} {
213 foreach type
{binary alpha compr
} {
216 for {set i
0} {$i < 1000} {incr i
} {
217 set bin
[randstring
0 10 $type]
221 if {$buf != [r get x
]} {
222 set err
"Expected '$buf' found '[r get x]'"
229 # Leave the user with a clean DB before to exit
234 lappend aux
[r dbsize
]
237 lappend aux
[r dbsize
]
240 test
{Perform a final SAVE to leave a clean DB on disk
} {