Skip to content

Commit 99917b8

Browse files
committed
out_logrotate: fix UT
Signed-off-by: SagiROosto <[email protected]>
1 parent 5cf07a7 commit 99917b8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

plugins/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@ REGISTER_OUT_PLUGIN("out_es")
364364
REGISTER_OUT_PLUGIN("out_exit")
365365
REGISTER_OUT_PLUGIN("out_file")
366366
REGISTER_OUT_PLUGIN("out_logrotate")
367-
368367
REGISTER_OUT_PLUGIN("out_forward")
369368
REGISTER_OUT_PLUGIN("out_http")
370369
REGISTER_OUT_PLUGIN("out_influxdb")

tests/runtime/out_logrotate.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static int recursive_delete_directory(const char *dir_path)
3838
{
3939
DIR *dir;
4040
struct dirent *entry;
41-
struct stat statbuf;
41+
struct stat statbuf;
4242
char path[PATH_MAX];
4343
int ret = 0;
4444

@@ -337,15 +337,17 @@ void flb_test_logrotate_max_files_cleanup(void)
337337
}
338338
sleep(1); /* Wait for flush */
339339
file_count = count_files_in_directory(TEST_LOGPATH, TEST_LOGFILE);
340-
TEST_CHECK(file_count <= 4);
340+
TEST_ASSERT(file_count >= 0);
341+
TEST_CHECK(file_count <= 4);
341342
}
342343

343344
flb_stop(ctx);
344345
flb_destroy(ctx);
345346

346347
/* Check that only Max_Files + 1 files exist (current + rotated) */
347348
file_count = count_files_in_directory(TEST_LOGPATH, TEST_LOGFILE);
348-
TEST_CHECK(file_count <= 4); /* Current file + 2 rotated files */
349+
TEST_ASSERT(file_count >= 0);
350+
TEST_CHECK(file_count <= 4); /* Current file + 3 rotated files (max_files=3) */
349351

350352
/* Clean up directory and all contents */
351353
recursive_delete_directory(TEST_LOGPATH);

0 commit comments

Comments
 (0)