From bb510b99e1b9846610c95dfb6da40a89ca8a5dcd Mon Sep 17 00:00:00 2001 From: Phillip Whelan Date: Thu, 4 Apr 2024 11:32:39 -0300 Subject: [PATCH] test: internal: log: fix failures caused by timing issue. Signed-off-by: Phillip Whelan --- tests/internal/log.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/internal/log.c b/tests/internal/log.c index af11b3b163c..e16ebc81819 100644 --- a/tests/internal/log.c +++ b/tests/internal/log.c @@ -81,14 +81,17 @@ static void cache_basic_timeout() cache = flb_log_cache_create(timeout, 4); TEST_CHECK(cache != NULL); + clock1 = time(NULL); ret_1 = flb_log_cache_check_suppress(cache, TEST_RECORD_01, TEST_RECORD_01_SIZE); + + clock2 = time(NULL); ret_2 = flb_log_cache_check_suppress(cache, TEST_RECORD_02, TEST_RECORD_02_SIZE); + TEST_CHECK(ret_1 == FLB_FALSE); TEST_CHECK(ret_2 == FLB_FALSE); + sleep(1); - clock1 = time(NULL); - clock2 = time(NULL); for (i = 1, start = time(NULL); i < 10 && start+(timeout*20) > time(NULL); i++) { ret_1 = flb_log_cache_check_suppress(cache, TEST_RECORD_01, TEST_RECORD_01_SIZE);