1 start_server
default.conf
{} {
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
15 foreach fuzztype
{binary alpha compr
} {
16 test
"FUZZ stresser with data model $fuzztype" {
18 for {set i
0} {$i < 10000} {incr i
} {
19 set fuzz
[randstring
0 512 $fuzztype]
23 set err
[list $fuzz $got]
42 test
{SELECT an out of range DB
} {
43 catch {r select
1000000} err
47 if {![catch {package require sha1
}]} {
48 test
{Check consistency of different data types
after a reload
} {
50 createComplexDataset r
10000
51 set sha1
[r debug digest
]
53 set sha1_after
[r debug digest
]
54 expr {$sha1 eq
$sha1_after}
57 test
{Same dataset digest
if saving
/reloading as AOF?
} {
61 set sha1_after
[r debug digest
]
62 expr {$sha1 eq
$sha1_after}
66 test
{EXPIRES
after a reload
(snapshot
+ append only
file)} {
73 set e1
[expr {$ttl > 900 && $ttl <= 1000}]
77 set e2
[expr {$ttl > 900 && $ttl <= 1000}]
81 test
{PIPELINING stresser
(also a regression
for the old epoll bug
)} {
82 set fd2
[socket $::host $::port]
83 fconfigure $fd2 -encoding binary -translation binary
84 puts -nonewline $fd2 "SELECT 9\r\n"
88 for {set i
0} {$i < 100000} {incr i
} {
90 set val
"0000${i}0000"
91 append q
"SET key:$i [string length $val]\r\n$val\r\n"
92 puts -nonewline $fd2 $q
94 append q
"GET key:$i\r\n"
95 puts -nonewline $fd2 $q
99 for {set i
0} {$i < 100000} {incr i
} {
102 set count
[string range
$count 1 end
]
103 set val
[read $fd2 $count]
110 test
{MUTLI
/ EXEC basics
} {
116 set v1
[r
lrange mylist
0 -1]
120 } {QUEUED QUEUED
{{a b c
} PONG
}}
128 set v1
[r del mylist
]
130 set v3
[r
lrange mylist
0 -1]
132 } {QUEUED OK
{a b c
}}
134 test
{Nested MULTI are not allowed
} {
137 catch {[r multi
]} err
142 test
{WATCH inside MULTI is not allowed
} {
145 catch {[r watch x
]} err
150 test
{APPEND basics
} {
151 list [r
append foo bar
] [r get foo
] \
152 [r
append foo
100] [r get foo
]
155 test
{APPEND basics
, integer encoded values
} {
160 lappend res
[r get foo
]
163 lappend res
[r get foo
]
166 test
{APPEND fuzzing
} {
168 foreach type
{binary alpha compr
} {
171 for {set i
0} {$i < 1000} {incr i
} {
172 set bin
[randstring
0 10 $type]
176 if {$buf != [r get x
]} {
177 set err
"Expected '$buf' found '[r get x]'"
184 test
{SUBSTR basics
} {
186 r
set foo
"Hello World"
187 lappend res
[r substr foo
0 3]
188 lappend res
[r substr foo
0 -1]
189 lappend res
[r substr foo
-4 -1]
190 lappend res
[r substr foo
5 3]
191 lappend res
[r substr foo
5 5000]
192 lappend res
[r substr foo
-5000 10000]
194 } {Hell
{Hello World
} orld
{} { World
} {Hello World
}}
196 test
{SUBSTR against integer encoded values
} {
201 test
{SUBSTR fuzzing
} {
203 for {set i
0} {$i < 1000} {incr i
} {
204 set bin
[randstring
0 1024 binary]
205 set _start
[set start
[randomInt
1500]]
206 set _end
[set end
[randomInt
1500]]
207 if {$_start < 0} {set _start
"end-[abs($_start)-1]"}
208 if {$_end < 0} {set _end
"end-[abs($_end)-1]"}
209 set s1
[string range
$bin $_start $_end]
211 set s2
[r substr bin
$start $end]
213 set err
"String mismatch"
220 # Leave the user with a clean DB before to exit
225 lappend aux
[r dbsize
]
228 lappend aux
[r dbsize
]
231 test
{Perform a final SAVE to leave a clean DB on disk
} {