fix recently added time sensitive tests failing with valgrind (#7512)

interestingly the latency monitor test fails because valgrind is slow
enough so that the time inside PEXPIREAT command from the moment of
the first mstime() call to get the basetime until checkAlreadyExpired
calls mstime() again is more than 1ms, and that test was too sensitive.

using this opportunity to speed up the test (unrelated to the failure)
the fix is just the longer time passed to PEXPIRE.

(cherry picked from commit 663e637da87ee9385527fe3a37edb241a1f97cc6)
This commit is contained in:
Oran Agra 2020-07-13 16:40:03 +03:00
parent 905ffb72e9
commit dde79afbf7
2 changed files with 12 additions and 6 deletions

View File

@ -241,7 +241,7 @@ start_server {tags {"cli"}} {
test_nontty_cli "Connecting as a replica" { test_nontty_cli "Connecting as a replica" {
set fd [open_cli "--replica"] set fd [open_cli "--replica"]
wait_for_condition 50 500 { wait_for_condition 200 500 {
[string match {*slave0:*state=online*} [r info]] [string match {*slave0:*state=online*} [r info]]
} else { } else {
fail "redis-cli --replica did not connect" fail "redis-cli --replica did not connect"

View File

@ -50,15 +50,21 @@ start_server {tags {"latency-monitor"}} {
test {LATENCY of expire events are correctly collected} { test {LATENCY of expire events are correctly collected} {
r config set latency-monitor-threshold 20 r config set latency-monitor-threshold 20
r flushdb
if {$::valgrind} {set count 100000} else {set count 1000000}
r eval { r eval {
local i = 0 local i = 0
while (i < 1000000) do while (i < tonumber(ARGV[1])) do
redis.call('sadd','mybigkey',i) redis.call('sadd',KEYS[1],i)
i = i+1 i = i+1
end end
} 0 } 1 mybigkey $count
r pexpire mybigkey 1 r pexpire mybigkey 50
after 500 wait_for_condition 5 100 {
[r dbsize] == 0
} else {
fail "key wasn't expired"
}
assert_match {*expire-cycle*} [r latency latest] assert_match {*expire-cycle*} [r latency latest]
} }
} }