Skip to content

Commit

Permalink
tests: runtime: in_tail: Add test for dmode_firstline for docker mode
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Rosiek <[email protected]>
  • Loading branch information
Dominik Rosiek authored and Magnus Sirviö committed Oct 7, 2020
1 parent 632e9e5 commit a90f35e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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"}
Original file line number Diff line number Diff line change
@@ -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"}
18 changes: 12 additions & 6 deletions tests/runtime/in_tail.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}
Expand Down Expand Up @@ -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}
};

0 comments on commit a90f35e

Please sign in to comment.