Skip to content

Commit 1d00d34

Browse files
committed
tests: internal: config_format_yaml: error configure_plugins_type on invalid properties
Signed-off-by: Bradley Laney <[email protected]>
1 parent 0f56a73 commit 1d00d34

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

tests/internal/config_format_yaml.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
22

33
#include <fluent-bit/flb_info.h>
4+
#include <fluent-bit/flb_input.h>
5+
#include <fluent-bit/flb_output.h>
46
#include <fluent-bit/flb_mem.h>
57
#include <fluent-bit/flb_kv.h>
68
#include <fluent-bit/flb_str.h>
@@ -833,6 +835,34 @@ static void test_upstream_servers()
833835
flb_cf_destroy(cf);
834836
}
835837

838+
static void test_invalid_property()
839+
{
840+
char* test_cases[] = {
841+
FLB_TESTS_CONF_PATH "/invalid_input_property.yaml",
842+
FLB_TESTS_CONF_PATH "/invalid_output_property.yaml",
843+
NULL,
844+
};
845+
846+
struct flb_cf *cf;
847+
struct flb_config *config;
848+
int ret;
849+
int i;
850+
851+
for (i = 0; test_cases[i] != NULL; i++) {
852+
cf = flb_cf_yaml_create(NULL, test_cases[i], NULL, 0);
853+
TEST_ASSERT(cf != NULL);
854+
855+
config = flb_config_init();
856+
TEST_ASSERT(config != NULL);
857+
858+
ret = flb_config_load_config_format(config, cf);
859+
TEST_ASSERT_(ret == -1, "expected invalid property to return an error in file %s", test_cases[i]);
860+
861+
flb_config_exit(config);
862+
flb_cf_destroy(cf);
863+
}
864+
}
865+
836866
TEST_LIST = {
837867
{ "basic" , test_basic},
838868
{ "customs section", test_customs_section},
@@ -846,5 +876,6 @@ TEST_LIST = {
846876
{ "stream_processor", test_stream_processor},
847877
{ "plugins", test_plugins},
848878
{ "upstream_servers", test_upstream_servers},
879+
{ "invalid_input_property", test_invalid_property},
849880
{ 0 }
850881
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pipeline:
2+
inputs:
3+
- name: dummy
4+
log_level: thisdoesnotexist
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pipeline:
2+
outputs:
3+
- name: stdout
4+
match: '*'
5+
log_level: thisdoesnotexist

0 commit comments

Comments
 (0)