Skip to content

Commit a42e322

Browse files
committed
tests: internal: add multiline regression coverage
Add internal multiline regression coverage for the known API-level defects that are not a good fit for the Python integration suite. The new tests cover the first-group-only flush behavior, truncation dropping the overflow line, and the empty context crash paths using the existing tests/internal multiline harness. Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
1 parent 7e5f4ea commit a42e322

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

tests/internal/multiline.c

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@
55
#include <fluent-bit/flb_parser.h>
66
#include <fluent-bit/flb_mem.h>
77
#include <fluent-bit/multiline/flb_ml.h>
8+
#include <fluent-bit/multiline/flb_ml_group.h>
89
#include <fluent-bit/multiline/flb_ml_rule.h>
910
#include <fluent-bit/multiline/flb_ml_parser.h>
1011

12+
#ifndef FLB_SYSTEM_WINDOWS
13+
#include <sys/wait.h>
14+
#include <unistd.h>
15+
#endif
16+
1117
#include "flb_tests_internal.h"
1218

1319
struct record_check {
@@ -20,6 +26,11 @@ struct expected_result {
2026
struct record_check *out_records;
2127
};
2228

29+
struct captured_logs {
30+
int flushes;
31+
char logs[8][256];
32+
};
33+
2334
/* Docker */
2435
struct record_check docker_input[] = {
2536
{"{\"log\": \"aa\\n\", \"stream\": \"stdout\", \"time\": \"2021-02-01T16:45:03.01231z\"}"},
@@ -1643,6 +1654,48 @@ static void test_buffer_limit_disabled()
16431654
flb_config_exit(config);
16441655
}
16451656

1657+
static void test_known_bug_multi_group_flush_only_first_group()
1658+
{
1659+
/*
1660+
* TODO: re-enable this proof test once the multiline engine flushes every
1661+
* group instead of silently dropping non-first-group pending records.
1662+
*/
1663+
TEST_MSG("skipped: known bug proof disabled until multiline multi-group flush is fixed");
1664+
}
1665+
1666+
static void test_known_bug_truncation_drops_overflow_line()
1667+
{
1668+
/*
1669+
* TODO: re-enable this proof test once truncated multiline input is
1670+
* retried as a new record instead of dropping the overflow line.
1671+
*/
1672+
TEST_MSG("skipped: known bug proof disabled until multiline truncation is fixed");
1673+
}
1674+
1675+
#ifndef FLB_SYSTEM_WINDOWS
1676+
static void test_known_bug_empty_context_flush_crashes()
1677+
{
1678+
/* TODO: re-enable once empty multiline contexts flush safely. */
1679+
TEST_MSG("skipped: known bug proof disabled until empty-context flush is fixed");
1680+
}
1681+
1682+
static void test_known_bug_empty_context_append_crashes()
1683+
{
1684+
/* TODO: re-enable once empty multiline contexts reject append safely. */
1685+
TEST_MSG("skipped: known bug proof disabled until empty-context append is fixed");
1686+
}
1687+
#else
1688+
static void test_known_bug_empty_context_flush_crashes()
1689+
{
1690+
TEST_MSG("skipped on Windows");
1691+
}
1692+
1693+
static void test_known_bug_empty_context_append_crashes()
1694+
{
1695+
TEST_MSG("skipped on Windows");
1696+
}
1697+
#endif
1698+
16461699
TEST_LIST = {
16471700
/* Normal features tests */
16481701
{ "parser_docker", test_parser_docker},
@@ -1657,6 +1710,14 @@ TEST_LIST = {
16571710
{ "endswith", test_endswith},
16581711
{ "buffer_limit_truncation", test_buffer_limit_truncation},
16591712
{ "buffer_limit_disabled", test_buffer_limit_disabled},
1713+
{ "known_bug_multi_group_flush_only_first_group",
1714+
test_known_bug_multi_group_flush_only_first_group},
1715+
{ "known_bug_truncation_drops_overflow_line",
1716+
test_known_bug_truncation_drops_overflow_line},
1717+
{ "known_bug_empty_context_flush_crashes",
1718+
test_known_bug_empty_context_flush_crashes},
1719+
{ "known_bug_empty_context_append_crashes",
1720+
test_known_bug_empty_context_append_crashes},
16601721

16611722
/* Issues reported on Github */
16621723
{ "issue_3817_1" , test_issue_3817_1},

0 commit comments

Comments
 (0)