From dde79afbf7959d0bff2c78099e66b7b70d43a68c Mon Sep 17 00:00:00 2001 From: Oran Agra Date: Mon, 13 Jul 2020 16:40:03 +0300 Subject: [PATCH] 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) --- tests/integration/redis-cli.tcl | 2 +- tests/unit/latency-monitor.tcl | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/integration/redis-cli.tcl b/tests/integration/redis-cli.tcl index 016e4915c..aa8b92199 100644 --- a/tests/integration/redis-cli.tcl +++ b/tests/integration/redis-cli.tcl @@ -241,7 +241,7 @@ start_server {tags {"cli"}} { test_nontty_cli "Connecting as a replica" { set fd [open_cli "--replica"] - wait_for_condition 50 500 { + wait_for_condition 200 500 { [string match {*slave0:*state=online*} [r info]] } else { fail "redis-cli --replica did not connect" diff --git a/tests/unit/latency-monitor.tcl b/tests/unit/latency-monitor.tcl index 69da13f06..d76867cc6 100644 --- a/tests/unit/latency-monitor.tcl +++ b/tests/unit/latency-monitor.tcl @@ -50,15 +50,21 @@ start_server {tags {"latency-monitor"}} { test {LATENCY of expire events are correctly collected} { r config set latency-monitor-threshold 20 + r flushdb + if {$::valgrind} {set count 100000} else {set count 1000000} r eval { local i = 0 - while (i < 1000000) do - redis.call('sadd','mybigkey',i) + while (i < tonumber(ARGV[1])) do + redis.call('sadd',KEYS[1],i) i = i+1 end - } 0 - r pexpire mybigkey 1 - after 500 + } 1 mybigkey $count + r pexpire mybigkey 50 + wait_for_condition 5 100 { + [r dbsize] == 0 + } else { + fail "key wasn't expired" + } assert_match {*expire-cycle*} [r latency latest] } }