From 9b20d598a5942aea31eb3b042a551b8d05eacccf Mon Sep 17 00:00:00 2001 From: Binbin Date: Thu, 22 Dec 2022 16:51:43 +0800 Subject: [PATCH] Fix flaky PTTL time to live in milliseconds test on slow machines (#11651) This test failed in FreeBSD: ``` *** [err]: PTTL returns time to live in milliseconds in tests/unit/expire.tcl Expected 836 > 900 && 836 <= 1000 (context: type eval line 5 cmd {assert {$ttl > 900 && $ttl <= 1000}} proc ::test) ``` On some slow machines, sometimes the test take close to 200ms to finish. We only set aside 100ms, so that caused the failure. Since the failure was around 800, change the condition to be >500. --- tests/unit/expire.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/expire.tcl b/tests/unit/expire.tcl index 8e4954a34..62ade68f5 100644 --- a/tests/unit/expire.tcl +++ b/tests/unit/expire.tcl @@ -151,7 +151,7 @@ start_server {tags {"expire"}} { r del x r setex x 1 somevalue set ttl [r pttl x] - assert {$ttl > 900 && $ttl <= 1000} + assert {$ttl > 500 && $ttl <= 1000} } test {TTL / PTTL / EXPIRETIME / PEXPIRETIME return -1 if key has no expire} {