34a8b517 |
1 | start_server {tags {"slowlog"} overrides {slowlog-log-slower-than 1000000}} { |
bbbf79dd |
2 | test {SLOWLOG - check that it starts with an empty log} { |
3 | r slowlog len |
4 | } {0} |
5 | |
6 | test {SLOWLOG - only logs commands taking more time than specified} { |
7 | r config set slowlog-log-slower-than 100000 |
8 | r ping |
9 | assert_equal [r slowlog len] 0 |
10 | r debug sleep 0.2 |
11 | assert_equal [r slowlog len] 1 |
12 | } |
13 | |
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} { |
18 | r ping |
19 | } |
20 | r slowlog len |
21 | } {10} |
22 | |
23 | test {SLOWLOG - GET optional argument to limit output len works} { |
24 | llength [r slowlog get 5] |
25 | } {5} |
26 | |
27 | test {SLOWLOG - RESET subcommand works} { |
28 | r config set slowlog-log-slower-than 100000 |
29 | r slowlog reset |
30 | r slowlog len |
31 | } {0} |
32 | |
33 | test {SLOWLOG - logged entry sanity check} { |
34 | r debug sleep 0.2 |
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} |
40 | } |
41 | } |