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+
836866TEST_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};
0 commit comments