Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: decoder_prometheus: add Fluent Bit issue test #9267 #217

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/data/issue_fluent_bit_9267.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_bu_nn 0 171798732
28 changes: 26 additions & 2 deletions tests/prometheus_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ void test_escape_sequences()
}

void test_metric_without_labels()
{
{
cfl_sds_t result;

const char expected[] =
Expand Down Expand Up @@ -776,7 +776,7 @@ void test_issue_fluent_bit_5541()
"http_request_duration_seconds_bucket{le=\"0.25\"} 2 0\n"
"http_request_duration_seconds_bucket{le=\"0.5\"} 2 0\n"
"http_request_duration_seconds_bucket{le=\"0.75\"} 2 0\n"
"http_request_duration_seconds_bucket{le=\"1.0\"} 2 0\n"
"http_request_duration_seconds_bucket{le=\"1.0\"} 2 0\n"
"http_request_duration_seconds_bucket{le=\"2.5\"} 2 0\n"
"http_request_duration_seconds_bucket{le=\"5.0\"} 2 0\n"
"http_request_duration_seconds_bucket{le=\"7.5\"} 2 0\n"
Expand Down Expand Up @@ -1665,6 +1665,29 @@ void test_issue_fluent_bit_6534()
cmt_decode_prometheus_destroy(cmt);
}

void test_issue_fluent_bit_9267()
{
char errbuf[256];
int status;
cfl_sds_t result = NULL;
struct cmt *cmt;
struct cmt_decode_prometheus_parse_opts opts;
memset(&opts, 0, sizeof(opts));
opts.errbuf = errbuf;
opts.errbuf_size = sizeof(errbuf);
cfl_sds_t in_buf = read_file(CMT_TESTS_DATA_PATH "/issue_fluent_bit_9267.txt");
size_t in_size = cfl_sds_len(in_buf);

status = cmt_decode_prometheus_create(&cmt, in_buf, in_size, &opts);
TEST_CHECK(status == 0);
if (status) {
fprintf(stderr, "PARSE ERROR:\n======\n%s\n======\n", errbuf);
}

cmt_decode_prometheus_destroy(cmt);
cfl_sds_destroy(in_buf);
}

TEST_LIST = {
{"header_help", test_header_help},
{"header_type", test_header_type},
Expand Down Expand Up @@ -1697,5 +1720,6 @@ TEST_LIST = {
{"pr_168", test_pr_168},
{"histogram_different_label_count", test_histogram_different_label_count},
{"issue_fluent_bit_6534", test_issue_fluent_bit_6534},
{"issue_fluent_bit_9267", test_issue_fluent_bit_9267},
{ 0 }
};
Loading