From fa1bba861906af4d1cc4d53afe4b21cbb45c7318 Mon Sep 17 00:00:00 2001 From: Binbin Date: Thu, 15 Feb 2024 16:44:49 +0800 Subject: [PATCH] Increase tolerance range to block reprocess tests to avoid timing issues (#13053) These tests have all failed in daily CI: ``` *** [err]: Blocking XREADGROUP for stream key that has clients blocked on stream - reprocessing command in tests/unit/type/stream-cgroups.tcl Expected '1101' to be between to '1000' and '1100' (context: type eval line 23 cmd {assert_range [expr $end-$start] 1000 1100} proc ::test) *** [err]: BLPOP unblock but the key is expired and then block again - reprocessing command in tests/unit/type/list.tcl Expected '1101' to be between to '1000' and '1100' (context: type eval line 23 cmd {assert_range [expr $end-$start] 1000 1100} proc ::test) *** [err]: BZPOPMIN unblock but the key is expired and then block again - reprocessing command in tests/unit/type/zset.tcl Expected '1103' to be between to '1000' and '1100' (context: type eval line 23 cmd {assert_range [expr $end-$start] 1000 1100} proc ::test) ``` Increase the range to avoid failures, and improve the comment to be clearer. tests was introduced in #13004. Signed-off-by: Ping Xie --- tests/unit/type/list.tcl | 6 +++--- tests/unit/type/stream-cgroups.tcl | 6 +++--- tests/unit/type/zset.tcl | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/unit/type/list.tcl b/tests/unit/type/list.tcl index 61ad98565..7c0fa87e3 100644 --- a/tests/unit/type/list.tcl +++ b/tests/unit/type/list.tcl @@ -1265,9 +1265,9 @@ foreach {pop} {BLPOP BLMPOP_LEFT} { assert_equal {} [$rd read] set end [clock milliseconds] - # In the past, this time would have been 1000+200, in order to avoid - # timing issues, we increase the range a bit. - assert_range [expr $end-$start] 1000 1100 + # Before the fix in #13004, this time would have been 1200+ (i.e. more than 1200ms), + # now it should be 1000, but in order to avoid timing issues, we increase the range a bit. + assert_range [expr $end-$start] 1000 1150 r debug set-active-expire 1 $rd close diff --git a/tests/unit/type/stream-cgroups.tcl b/tests/unit/type/stream-cgroups.tcl index 242059ef7..46e0b05c5 100644 --- a/tests/unit/type/stream-cgroups.tcl +++ b/tests/unit/type/stream-cgroups.tcl @@ -518,9 +518,9 @@ start_server { assert_equal {} [$rd2 read] set end [clock milliseconds] - # In the past, this time would have been 1000+200, in order to avoid - # timing issues, we increase the range a bit. - assert_range [expr $end-$start] 1000 1100 + # Before the fix in #13004, this time would have been 1200+ (i.e. more than 1200ms), + # now it should be 1000, but in order to avoid timing issues, we increase the range a bit. + assert_range [expr $end-$start] 1000 1150 $rd1 close $rd2 close diff --git a/tests/unit/type/zset.tcl b/tests/unit/type/zset.tcl index 7836577a2..e84cb0e30 100644 --- a/tests/unit/type/zset.tcl +++ b/tests/unit/type/zset.tcl @@ -1962,9 +1962,9 @@ start_server {tags {"zset"}} { assert_equal {} [$rd read] set end [clock milliseconds] - # In the past, this time would have been 1000+200, in order to avoid - # timing issues, we increase the range a bit. - assert_range [expr $end-$start] 1000 1100 + # Before the fix in #13004, this time would have been 1200+ (i.e. more than 1200ms), + # now it should be 1000, but in order to avoid timing issues, we increase the range a bit. + assert_range [expr $end-$start] 1000 1150 r debug set-active-expire 1 $rd close