mirror of
https://github.com/falcosecurity/falco.git
synced 2025-08-01 14:37:49 +00:00
tests: call the callback action
only once
moreover this commit corrects `cpus_for_each_syscall_buffer` into test configs Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
This commit is contained in:
parent
11253cc0eb
commit
1b14fed380
@ -19,5 +19,5 @@ limitations under the License.
|
||||
#include <falco/app/state.h>
|
||||
#include <falco/app/actions/actions.h>
|
||||
|
||||
#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, ""); }
|
||||
|
@ -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());
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user