mirror of
https://github.com/falcosecurity/falco.git
synced 2025-06-24 13:52:16 +00:00
fix: fix some broken tests
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
This commit is contained in:
parent
249ccf2f4b
commit
4443e9d64f
@ -46,11 +46,10 @@ TEST(ActionLoadConfig, check_engine_config_is_correctly_parsed)
|
||||
EXPECT_TRUE(s.config->m_gvisor.m_config.empty());
|
||||
EXPECT_TRUE(s.config->m_gvisor.m_root.empty());
|
||||
|
||||
// Check that deprecated configs are not populated since we are using
|
||||
// the new config.
|
||||
EXPECT_EQ(s.config->m_syscall_buf_size_preset, 0);
|
||||
EXPECT_EQ(s.config->m_cpus_for_each_syscall_buffer, 0);
|
||||
EXPECT_FALSE(s.config->m_syscall_drop_failed_exit);
|
||||
// Check that deprecated configs are always set since
|
||||
EXPECT_EQ(s.config->m_syscall_buf_size_preset, 6);
|
||||
EXPECT_EQ(s.config->m_cpus_for_each_syscall_buffer, 7);
|
||||
EXPECT_TRUE(s.config->m_syscall_drop_failed_exit);
|
||||
}
|
||||
|
||||
// Equal to the one above but checks that the command line options are not parsed
|
||||
@ -82,11 +81,10 @@ TEST(ActionLoadConfig, check_command_line_options_are_not_used)
|
||||
EXPECT_TRUE(s.config->m_gvisor.m_config.empty());
|
||||
EXPECT_TRUE(s.config->m_gvisor.m_root.empty());
|
||||
|
||||
// Check that deprecated configs are not populated since we are using
|
||||
// the new config.
|
||||
EXPECT_EQ(s.config->m_syscall_buf_size_preset, 0);
|
||||
EXPECT_EQ(s.config->m_cpus_for_each_syscall_buffer, 0);
|
||||
EXPECT_FALSE(s.config->m_syscall_drop_failed_exit);
|
||||
// Check that deprecated configs are always set since
|
||||
EXPECT_EQ(s.config->m_syscall_buf_size_preset, 6);
|
||||
EXPECT_EQ(s.config->m_cpus_for_each_syscall_buffer, 7);
|
||||
EXPECT_TRUE(s.config->m_syscall_drop_failed_exit);
|
||||
}
|
||||
|
||||
TEST(ActionLoadConfig, check_kmod_with_syscall_configs)
|
||||
|
@ -124,6 +124,11 @@ void falco_configuration::load_engine_config(const std::string& config_name, con
|
||||
throw std::logic_error("Error reading config file (" + config_name + "): engine.kind '"+ driver_mode_str + "' is not a valid kind.");
|
||||
}
|
||||
|
||||
// Catch deprecated values from the config, to use them with the command line if needed
|
||||
m_syscall_buf_size_preset = config.get_scalar<int16_t>("syscall_buf_size_preset", DEFAULT_BUF_SIZE_PRESET);
|
||||
m_cpus_for_each_syscall_buffer = config.get_scalar<uint16_t>("modern_bpf.cpus_for_each_syscall_buffer", DEFAULT_CPUS_FOR_EACH_SYSCALL_BUFFER);
|
||||
m_syscall_drop_failed_exit = config.get_scalar<bool>("syscall_drop_failed_exit", DEFAULT_DROP_FAILED_EXIT);
|
||||
|
||||
switch (m_engine_mode)
|
||||
{
|
||||
case engine_kind_t::KMOD:
|
||||
@ -178,11 +183,6 @@ void falco_configuration::load_engine_config(const std::string& config_name, con
|
||||
// Please note that `load_config` could be called more than one time during initialization
|
||||
// so the last time wins, the load config phase should be idempotent
|
||||
m_changes_in_engine_config = true;
|
||||
|
||||
// Catch deprecated values from the config, to use them with the command line if needed
|
||||
m_syscall_buf_size_preset = config.get_scalar<int16_t>("syscall_buf_size_preset", DEFAULT_BUF_SIZE_PRESET);
|
||||
m_cpus_for_each_syscall_buffer = config.get_scalar<uint16_t>("modern_bpf.cpus_for_each_syscall_buffer", DEFAULT_CPUS_FOR_EACH_SYSCALL_BUFFER);
|
||||
m_syscall_drop_failed_exit = config.get_scalar<bool>("syscall_drop_failed_exit", DEFAULT_DROP_FAILED_EXIT);
|
||||
}
|
||||
|
||||
void falco_configuration::load_yaml(const std::string& config_name, const yaml_helper& config)
|
||||
|
Loading…
Reference in New Issue
Block a user