|
32 | 32 | #define FLB_004 FLB_TESTS_CONF_PATH "/stream_processor.yaml" |
33 | 33 | #define FLB_005 FLB_TESTS_CONF_PATH "/plugins.yaml" |
34 | 34 | #define FLB_006 FLB_TESTS_CONF_PATH "/upstream.yaml" |
| 35 | +#define FLB_PARSERS_LIST FLB_TESTS_CONF_PATH "/parsers/parsers-list.yaml" |
35 | 36 |
|
36 | 37 | #define FLB_000_WIN FLB_TESTS_CONF_PATH "\\fluent-bit-windows.yaml" |
37 | 38 | #define FLB_BROKEN_PLUGIN_VARIANT FLB_TESTS_CONF_PATH "/broken_plugin_variant.yaml" |
@@ -322,6 +323,42 @@ static void test_parser_conf() |
322 | 323 | flb_config_exit(config); |
323 | 324 | } |
324 | 325 |
|
| 326 | +static void test_parser_conf_list(void) |
| 327 | +{ |
| 328 | + struct flb_cf *cf; |
| 329 | + struct flb_config *config; |
| 330 | + int ret; |
| 331 | + int cnt; |
| 332 | + |
| 333 | + cf = flb_cf_yaml_create(NULL, FLB_PARSERS_LIST, NULL, 0); |
| 334 | + TEST_CHECK(cf != NULL); |
| 335 | + if (!cf) { |
| 336 | + exit(EXIT_FAILURE); |
| 337 | + } |
| 338 | + |
| 339 | + config = flb_config_init(); |
| 340 | + TEST_CHECK(config != NULL); |
| 341 | + config->conf_path = flb_strdup(FLB_TESTS_CONF_PATH "/parsers/"); |
| 342 | + |
| 343 | + /* Count the parsers registered automatically by fluent-bit */ |
| 344 | + cnt = mk_list_size(&config->parsers); |
| 345 | + |
| 346 | + ret = flb_config_load_config_format(config, cf); |
| 347 | + if (ret != 0) { |
| 348 | + exit(EXIT_FAILURE); |
| 349 | + } |
| 350 | + |
| 351 | + if (!TEST_CHECK(mk_list_size(&config->parsers) == cnt + 2)) { |
| 352 | + TEST_MSG("Section number error. Got=%d expect=%d", |
| 353 | + mk_list_size(&config->parsers), |
| 354 | + cnt + 2); |
| 355 | + } |
| 356 | + |
| 357 | + flb_cf_dump(cf); |
| 358 | + flb_cf_destroy(cf); |
| 359 | + flb_config_exit(config); |
| 360 | +} |
| 361 | + |
325 | 362 | static inline int check_camel_to_snake(char *input, char *output) |
326 | 363 | { |
327 | 364 | int len; |
@@ -880,6 +917,7 @@ TEST_LIST = { |
880 | 917 | { "slist odd", test_slist_odd}, |
881 | 918 | { "slist even", test_slist_even}, |
882 | 919 | { "parsers file conf", test_parser_conf}, |
| 920 | + { "parsers file conf list", test_parser_conf_list}, |
883 | 921 | { "camel_case_key", test_camel_case_key}, |
884 | 922 | { "processors", test_processors}, |
885 | 923 | { "parsers_and_multiline_parsers", test_parsers_and_multiline_parsers}, |
|
0 commit comments