Skip to content

Commit

Permalink
test: internal: log: fix failures caused by timing issue.
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Whelan <[email protected]>
  • Loading branch information
pwhelan authored and edsiper committed Apr 10, 2024
1 parent d729ea0 commit bb510b9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/internal/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bb510b9

Please sign in to comment.