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
{APPEND basics
} {
135 list [r
append foo bar
] [r get foo
] \
136 [r
append foo
100] [r get foo
]
139 test
{APPEND basics
, integer encoded values
} {
144 lappend res
[r get foo
]
147 lappend res
[r get foo
]
150 test
{APPEND fuzzing
} {
152 foreach type
{binary alpha compr
} {
155 for {set i
0} {$i < 1000} {incr i
} {
156 set bin
[randstring
0 10 $type]
160 if {$buf != [r get x
]} {
161 set err
"Expected '$buf' found '[r get x]'"
168 test
{SUBSTR basics
} {
170 r
set foo
"Hello World"
171 lappend res
[r substr foo
0 3]
172 lappend res
[r substr foo
0 -1]
173 lappend res
[r substr foo
-4 -1]
174 lappend res
[r substr foo
5 3]
175 lappend res
[r substr foo
5 5000]
176 lappend res
[r substr foo
-5000 10000]
178 } {Hell
{Hello World
} orld
{} { World
} {Hello World
}}
180 test
{SUBSTR against integer encoded values
} {
185 test
{SUBSTR fuzzing
} {
187 for {set i
0} {$i < 1000} {incr i
} {
188 set bin
[randstring
0 1024 binary]
189 set _start
[set start
[randomInt
1500]]
190 set _end
[set end
[randomInt
1500]]
191 if {$_start < 0} {set _start
"end-[abs($_start)-1]"}
192 if {$_end < 0} {set _end
"end-[abs($_end)-1]"}
193 set s1
[string range
$bin $_start $_end]
195 set s2
[r substr bin
$start $end]
197 set err
"String mismatch"
204 # Leave the user with a clean DB before to exit
209 lappend aux
[r dbsize
]
212 lappend aux
[r dbsize
]
215 test
{Perform a final SAVE to leave a clean DB on disk
} {