summaryrefslogtreecommitdiff
path: root/tests/unit/slowlog.tcl
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2017-06-15 12:57:54 +0200
committerantirez <antirez@gmail.com>2017-06-15 12:57:54 +0200
commit53cb27b1d718a12e9ff89212ca9b68db12031dde (patch)
tree788b70c5c35de134664f067aefcee9e0d86b36a8 /tests/unit/slowlog.tcl
parentab9d398835dca1187f190b28786cd9cc28e1fea1 (diff)
downloadredis-53cb27b1d718a12e9ff89212ca9b68db12031dde.tar.gz
SLOWLOG: log offending client address and name.
Diffstat (limited to 'tests/unit/slowlog.tcl')
-rw-r--r--tests/unit/slowlog.tcl13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/unit/slowlog.tcl b/tests/unit/slowlog.tcl
index b25b91e2c..fce02498b 100644
--- a/tests/unit/slowlog.tcl
+++ b/tests/unit/slowlog.tcl
@@ -31,12 +31,14 @@ start_server {tags {"slowlog"} overrides {slowlog-log-slower-than 1000000}} {
} {0}
test {SLOWLOG - logged entry sanity check} {
+ r client setname foobar
r debug sleep 0.2
set e [lindex [r slowlog get] 0]
- assert_equal [llength $e] 4
+ assert_equal [llength $e] 6
assert_equal [lindex $e 0] 105
assert_equal [expr {[lindex $e 2] > 100000}] 1
assert_equal [lindex $e 3] {debug sleep 0.2}
+ assert_equal {foobar} [lindex $e 5]
}
test {SLOWLOG - commands with too many arguments are trimmed} {
@@ -67,4 +69,13 @@ start_server {tags {"slowlog"} overrides {slowlog-log-slower-than 1000000}} {
set e [lindex [r slowlog get] 0]
assert_equal [lindex $e 3] {debug sleep 0.2}
}
+
+ test {SLOWLOG - can clean older entires} {
+ r client setname lastentry_client
+ r config set slowlog-max-len 1
+ r debug sleep 0.2
+ assert {[llength [r slowlog get]] == 1}
+ set e [lindex [r slowlog get] 0]
+ assert_equal {lastentry_client} [lindex $e 5]
+ }
}