diff --git a/tests/runtime/data/tail/log/dockermode_firstline_detection.log b/tests/runtime/data/tail/log/dockermode_firstline_detection.log new file mode 100644 index 00000000000..56a2711aa89 --- /dev/null +++ b/tests/runtime/data/tail/log/dockermode_firstline_detection.log @@ -0,0 +1,9 @@ +{"log":"Single log\n"} +{"log":"Second log\n"} +{"log":"Third log\n"} +{"log":"2020-03-24 Multiple lines: \n"} +{"log":"first bullet point\n"} +{"log":"second bullet point\n"} +{"log":"third bullet point\n"} +{"log":"fourth bullet point\n"} +{"log":"2020-03-24 Single line\n"} diff --git a/tests/runtime/data/tail/out/dockermode_firstline_detection.out b/tests/runtime/data/tail/out/dockermode_firstline_detection.out new file mode 100644 index 00000000000..00eecce98eb --- /dev/null +++ b/tests/runtime/data/tail/out/dockermode_firstline_detection.out @@ -0,0 +1,5 @@ +{"log":"Single log\n"} +{"log":"Second log\n"} +{"log":"Third log\n"} +{"log":"2020-03-24 Multiple lines: \nfirst bullet point\nsecond bullet point\nthird bullet point\nfourth bullet point\n"} +{"log":"2020-03-24 Single line\n"} diff --git a/tests/runtime/in_tail.c b/tests/runtime/in_tail.c index 6461b57ce9d..fdc40b48a61 100644 --- a/tests/runtime/in_tail.c +++ b/tests/runtime/in_tail.c @@ -130,7 +130,6 @@ static struct tail_file_lines *get_out_file_content(const char *target) } } - // printf("Just before return: %s\n", file_lines.lines[0]); return file_lines; } @@ -144,7 +143,6 @@ static int cb_check_result(void *record, size_t size, void *data) char *check; out = get_out_file_content(result->target); - // printf("What we got from function: %s\n", out.lines[0]); if (!out->lines_c) { goto exit; } @@ -282,14 +280,22 @@ void flb_test_in_tail_dockermode_splitted_multiple_lines() NULL); } +void flb_test_in_tail_dockermode_firstline_detection() +{ + do_test("tail", "dockermode_firstline_detection", 20000, 5, + "Docker_Mode_Parser", "docker_multiline", + NULL); +} + /* Test list */ TEST_LIST = { #ifdef in_tail - {"in_tail_dockermode", flb_test_in_tail_dockermode}, - {"in_tail_dockermode_splitted_line", flb_test_in_tail_dockermode_splitted_line}, - {"in_tail_dockermode_multiple_lines", flb_test_in_tail_dockermode_multiple_lines}, - {"in_tail_dockermode_splitted_multiple_lines", flb_test_in_tail_dockermode_splitted_multiple_lines}, + {"in_tail_dockermode", flb_test_in_tail_dockermode}, + {"in_tail_dockermode_splitted_line", flb_test_in_tail_dockermode_splitted_line}, + {"in_tail_dockermode_multiple_lines", flb_test_in_tail_dockermode_multiple_lines}, + {"in_tail_dockermode_splitted_multiple_lines", flb_test_in_tail_dockermode_splitted_multiple_lines}, + {"in_tail_dockermode_firstline_detection", flb_test_in_tail_dockermode_firstline_detection}, #endif {NULL, NULL} };