Tests for the rate limited logging macros.
More...
#include <freeradius-devel/util/test/acutest.h>
#include <freeradius-devel/util/test/acutest_helpers.h>
#include <freeradius-devel/server/log.h>
Go to the source code of this file.
Tests for the rate limited logging macros.
- Copyright
- 2026 Network RADIUS SAS ("legal@networkradius.com")
Definition in file log_tests.c.
◆ CAPTURE_LOG
◆ capture_reset()
| static void capture_reset |
( |
void |
| ) |
|
|
static |
◆ test_first_message_logged()
| static void test_first_message_logged |
( |
void |
| ) |
|
|
static |
The first message from a fresh entry is logged, even in the first second of the process.
fr_time() counts from fr_time_start(). A fresh entry has last_complained of zero, which is second 0, and a message in second 0 of the process compared equal to it and was counted as a repeat instead of being logged.
Definition at line 52 of file log_tests.c.
◆ test_repeat_count_reported()
| static void test_repeat_count_reported |
( |
void |
| ) |
|
|
static |
A message one second after the last one reports the repeats suppressed in between.
The macro set last_complained to now before computing the time since the last complaint, which was then always zero, and the suffix never appeared.
Definition at line 86 of file log_tests.c.
◆ test_repeat_suppressed()
| static void test_repeat_suppressed |
( |
void |
| ) |
|
|
static |
A second message in the same second is counted, not logged.
Definition at line 68 of file log_tests.c.
◆ captured
◆ logged
◆ TEST_LIST
Initial value:= {
}
static void test_first_message_logged(void)
The first message from a fresh entry is logged, even in the first second of the process.
static void test_repeat_suppressed(void)
A second message in the same second is counted, not logged.
static void test_repeat_count_reported(void)
A message one second after the last one reports the repeats suppressed in between.
Definition at line 101 of file log_tests.c.