Skip to content

Commit 9711d3e

Browse files
committed
tests: prometheus_parser: add issue flb 9267
Signed-off-by: Eduardo Silva <[email protected]>
1 parent acff4f0 commit 9711d3e

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_bu_nn 0 171798732

tests/prometheus_parser.c

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ void test_escape_sequences()
261261
}
262262

263263
void test_metric_without_labels()
264-
{
264+
{
265265
cfl_sds_t result;
266266

267267
const char expected[] =
@@ -776,7 +776,7 @@ void test_issue_fluent_bit_5541()
776776
"http_request_duration_seconds_bucket{le=\"0.25\"} 2 0\n"
777777
"http_request_duration_seconds_bucket{le=\"0.5\"} 2 0\n"
778778
"http_request_duration_seconds_bucket{le=\"0.75\"} 2 0\n"
779-
"http_request_duration_seconds_bucket{le=\"1.0\"} 2 0\n"
779+
"http_request_duration_seconds_bucket{le=\"1.0\"} 2 0\n"
780780
"http_request_duration_seconds_bucket{le=\"2.5\"} 2 0\n"
781781
"http_request_duration_seconds_bucket{le=\"5.0\"} 2 0\n"
782782
"http_request_duration_seconds_bucket{le=\"7.5\"} 2 0\n"
@@ -1665,6 +1665,29 @@ void test_issue_fluent_bit_6534()
16651665
cmt_decode_prometheus_destroy(cmt);
16661666
}
16671667

1668+
void test_issue_fluent_bit_9267()
1669+
{
1670+
char errbuf[256];
1671+
int status;
1672+
cfl_sds_t result = NULL;
1673+
struct cmt *cmt;
1674+
struct cmt_decode_prometheus_parse_opts opts;
1675+
memset(&opts, 0, sizeof(opts));
1676+
opts.errbuf = errbuf;
1677+
opts.errbuf_size = sizeof(errbuf);
1678+
cfl_sds_t in_buf = read_file(CMT_TESTS_DATA_PATH "/issue_fluent_bit_9267.txt");
1679+
size_t in_size = cfl_sds_len(in_buf);
1680+
1681+
status = cmt_decode_prometheus_create(&cmt, in_buf, in_size, &opts);
1682+
TEST_CHECK(status == 0);
1683+
if (status) {
1684+
fprintf(stderr, "PARSE ERROR:\n======\n%s\n======\n", errbuf);
1685+
}
1686+
1687+
cmt_decode_prometheus_destroy(cmt);
1688+
cfl_sds_destroy(in_buf);
1689+
}
1690+
16681691
TEST_LIST = {
16691692
{"header_help", test_header_help},
16701693
{"header_type", test_header_type},
@@ -1697,5 +1720,6 @@ TEST_LIST = {
16971720
{"pr_168", test_pr_168},
16981721
{"histogram_different_label_count", test_histogram_different_label_count},
16991722
{"issue_fluent_bit_6534", test_issue_fluent_bit_6534},
1723+
{"issue_fluent_bit_9267", test_issue_fluent_bit_9267},
17001724
{ 0 }
17011725
};

0 commit comments

Comments
 (0)