Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
a94aa39c
Commit
a94aa39c
authored
Jul 10, 2014
by
antirez
Browse files
LATENCY command / monitor basic tests.
parent
0dcc754f
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/unit/latency-monitor.tcl
0 → 100644
View file @
a94aa39c
start_server
{
tags
{
"latency-monitor"
}}
{
# Set a threshold high enough to avoid spurious latency events.
r config set latency-monitor-threshold 200
r latency reset
test
{
Test latency events logging
}
{
r debug sleep 0.3
after 1100
r debug sleep 0.4
after 1100
r debug sleep 0.5
assert
{[
r latency history command
]
>= 3
}
}
test
{
LATENCY HISTORY output is ok
}
{
set min 250
set max 450
foreach event
[
r latency history command
]
{
lassign $event time latency
assert
{
$latency
>= $min && $latency <= $max
}
incr min 100
incr max 100
set last_time $time
;
# Used in the next test
}
}
test
{
LATENCY LATEST output is ok
}
{
foreach event
[
r latency latest
]
{
lassign $event eventname time latency max
assert
{
$eventname
eq
"command"
}
assert
{
$max
>= 450 & $max <= 650
}
assert
{
$time
== $last_time
}
break
}
}
test
{
LATENCY HISTORY / RESET with wrong event name is fine
}
{
assert
{[
llength
[
r latency history blabla
]]
== 0
}
assert
{[
r latency reset blabla
]
== 0
}
}
test
{
LATENCY DOCTOR produces some output
}
{
assert
{[
string length
[
r latency doctor
]]
> 0
}
}
test
{
LATENCY RESET is able to reset events
}
{
assert
{[
r latency reset
]
> 0
}
assert
{[
r latency latest
]
eq
{}}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment