diff --git a/unit_tests/falco/app/actions/app_action_helpers.h b/unit_tests/falco/app/actions/app_action_helpers.h index 7467efee..cd79ffd0 100644 --- a/unit_tests/falco/app/actions/app_action_helpers.h +++ b/unit_tests/falco/app/actions/app_action_helpers.h @@ -19,5 +19,5 @@ limitations under the License. #include #include -#define EXPECT_ACTION_OK(r) { EXPECT_TRUE(r.success); EXPECT_TRUE(r.proceed); EXPECT_EQ(r.errstr, ""); } -#define EXPECT_ACTION_FAIL(r) { EXPECT_FALSE(r.success); EXPECT_FALSE(r.proceed); EXPECT_NE(r.errstr, ""); } +#define EXPECT_ACTION_OK(r) { auto result = r; EXPECT_TRUE(result.success); EXPECT_TRUE(result.proceed); EXPECT_EQ(result.errstr, ""); } +#define EXPECT_ACTION_FAIL(r) { auto result = r; EXPECT_FALSE(result.success); EXPECT_FALSE(result.proceed); EXPECT_NE(result.errstr, ""); } diff --git a/unit_tests/falco/app/actions/test_load_config.cpp b/unit_tests/falco/app/actions/test_load_config.cpp index f1a1c22a..30e3b92e 100644 --- a/unit_tests/falco/app/actions/test_load_config.cpp +++ b/unit_tests/falco/app/actions/test_load_config.cpp @@ -18,14 +18,12 @@ limitations under the License. #include "app_action_helpers.h" #include "falco_test_var.h" -auto action = falco::app::actions::load_config; TEST(ActionLoadConfig, check_engine_config_is_correctly_parsed) { falco::app::state s = {}; s.options.conf_filename = NEW_ENGINE_CONFIG_CHANGED; - // TODO: understand why load_yaml is called more times - EXPECT_ACTION_OK(action(s)); + EXPECT_ACTION_OK(falco::app::actions::load_config(s)); // Check that the engine is the kmod EXPECT_TRUE(s.config->m_engine_mode == engine_kind_t::KMOD); @@ -61,7 +59,7 @@ TEST(ActionLoadConfig, check_command_line_options_are_not_used) falco::app::state s; s.options.modern_bpf = true; s.options.conf_filename = NEW_ENGINE_CONFIG_CHANGED; - EXPECT_ACTION_OK(action(s)); + EXPECT_ACTION_OK(falco::app::actions::load_config(s)); // Check that the engine is the kmod EXPECT_TRUE(s.config->m_engine_mode == engine_kind_t::KMOD); @@ -95,7 +93,7 @@ TEST(ActionLoadConfig, check_kmod_with_syscall_configs) { falco::app::state s; s.options.conf_filename = NEW_ENGINE_CONFIG_UNCHANGED; - EXPECT_ACTION_OK(action(s)); + EXPECT_ACTION_OK(falco::app::actions::load_config(s)); // Check that the engine is the kmod EXPECT_TRUE(s.config->m_engine_mode == engine_kind_t::KMOD); @@ -132,7 +130,7 @@ TEST(ActionLoadConfig, check_override_command_line_modern) // config is unchanged s.options.modern_bpf = true; s.options.conf_filename = NEW_ENGINE_CONFIG_UNCHANGED; - EXPECT_ACTION_OK(action(s)); + EXPECT_ACTION_OK(falco::app::actions::load_config(s)); // Check that the engine is the kmod EXPECT_TRUE(s.is_modern_ebpf()); @@ -170,7 +168,7 @@ TEST(ActionLoadConfig, check_override_command_line_gvisor) // config is unchanged s.options.gvisor_config = "config"; s.options.conf_filename = NEW_ENGINE_CONFIG_UNCHANGED; - EXPECT_ACTION_OK(action(s)); + EXPECT_ACTION_OK(falco::app::actions::load_config(s)); // Check that the engine is the kmod EXPECT_TRUE(s.is_gvisor()); diff --git a/unit_tests/falco/test_configs/new_engine_config_changed.yaml b/unit_tests/falco/test_configs/new_engine_config_changed.yaml index e0db0d74..a2287573 100644 --- a/unit_tests/falco/test_configs/new_engine_config_changed.yaml +++ b/unit_tests/falco/test_configs/new_engine_config_changed.yaml @@ -49,4 +49,4 @@ syscall_buf_size_preset: 6 syscall_drop_failed_exit: true modern_bpf: - cpus_for_each_buffer: 7 + cpus_for_each_syscall_buffer: 7 diff --git a/unit_tests/falco/test_configs/new_engine_config_unchanged.yaml b/unit_tests/falco/test_configs/new_engine_config_unchanged.yaml index bb21b2e5..f262f603 100644 --- a/unit_tests/falco/test_configs/new_engine_config_unchanged.yaml +++ b/unit_tests/falco/test_configs/new_engine_config_unchanged.yaml @@ -50,4 +50,4 @@ syscall_buf_size_preset: 6 syscall_drop_failed_exit: true modern_bpf: - cpus_for_each_buffer: 3 + cpus_for_each_syscall_buffer: 3