Skip to content

Commit

Permalink
update(tests): add test for plugin init_config map
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Guerra <[email protected]>
  • Loading branch information
LucaGuerra authored and poiana committed Sep 20, 2024
1 parent 1a4a293 commit 50f4bc1
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions unit_tests/falco/test_configuration_schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,34 @@ TEST(Configuration, schema_wrong_embedded_key)
EXPECT_VALIDATION_STATUS(res, yaml_helper::validation_failed);
}

TEST(Configuration, plugin_init_config)
{
falco_configuration falco_config;
config_loaded_res res;

std::string config = R"(
plugins:
- name: k8saudit
library_path: libk8saudit.so
init_config:
maxEventSize: 262144
sslCertificate: /etc/falco/falco.pem
)";

EXPECT_NO_THROW(res = falco_config.init_from_content(config, {}));
EXPECT_VALIDATION_STATUS(res, yaml_helper::validation_ok);

config = R"(
plugins:
- name: k8saudit
library_path: libk8saudit.so
init_config: '{"maxEventSize": 262144, "sslCertificate": "/etc/falco/falco.pem"}'
)";

EXPECT_NO_THROW(res = falco_config.init_from_content(config, {}));
EXPECT_VALIDATION_STATUS(res, yaml_helper::validation_ok);
}

TEST(Configuration, schema_yaml_helper_validator)
{
yaml_helper conf;
Expand Down

0 comments on commit 50f4bc1

Please sign in to comment.