1 start_server
{tags
{"slowlog"} overrides
{slowlog-log-slower-than
1000000}} {
2 test
{SLOWLOG
- check that it starts with an empty log
} {
6 test
{SLOWLOG
- only logs commands taking more
time than specified
} {
7 r config
set slowlog-log-slower-than
100000
9 assert_equal
[r slowlog len
] 0
11 assert_equal
[r slowlog len
] 1
14 test
{SLOWLOG
- max entries is correctly handled
} {
15 r config
set slowlog-log-slower-than
0
16 r config
set slowlog-max-len
10
17 for {set i
0} {$i < 100} {incr i
} {
23 test
{SLOWLOG
- GET optional argument to limit output len works
} {
24 llength [r slowlog get
5]
27 test
{SLOWLOG
- RESET subcommand works
} {
28 r config
set slowlog-log-slower-than
100000
33 test
{SLOWLOG
- logged
entry sanity check
} {
35 set e
[lindex [r slowlog get
] 0]
36 assert_equal
[llength $e] 4
37 assert_equal
[lindex $e 0] 105
38 assert_equal
[expr {[lindex $e 2] > 100000}] 1
39 assert_equal
[lindex $e 3] {debug sleep
0.2}
42 test
{SLOWLOG
- commands with too many arguments are trimmed
} {
43 r config
set slowlog-log-slower-than
0
45 r sadd
set 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
46 set e
[lindex [r slowlog get
] 0]
48 } {sadd
set 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 {...
(2 more arguments
)}}
50 test
{SLOWLOG
- too long arguments are trimmed
} {
51 r config
set slowlog-log-slower-than
0
53 set arg
[string repeat A
129]
55 set e
[lindex [r slowlog get
] 0]
57 } {sadd
set foo
{AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
(1 more bytes
)}}