mirror of
https://github.com/falcosecurity/falco.git
synced 2025-06-28 15:47:25 +00:00
cleanup: solve std namespace issues and remove unused imports
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
parent
010f6c6a9e
commit
4706cd8b4e
@ -35,7 +35,7 @@ TEST(Configuration, configuration_exceptions)
|
||||
yaml_helper conf;
|
||||
|
||||
/* Broken YAML */
|
||||
string sample_broken_yaml = sample_yaml + " / bad_symbol";
|
||||
std::string sample_broken_yaml = sample_yaml + " / bad_symbol";
|
||||
EXPECT_ANY_THROW(conf.load_from_string(sample_broken_yaml));
|
||||
|
||||
/* Right YAML */
|
||||
@ -67,16 +67,16 @@ TEST(Configuration, read_yaml_fields)
|
||||
|
||||
/* get some fields */
|
||||
ASSERT_EQ(conf.get_scalar<int>("base_value.id", -1), 1);
|
||||
ASSERT_STREQ(conf.get_scalar<string>("base_value.name", "none").c_str(), "sample_name");
|
||||
ASSERT_STREQ(conf.get_scalar<std::string>("base_value.name", "none").c_str(), "sample_name");
|
||||
ASSERT_EQ(conf.get_scalar<bool>("base_value.subvalue.subvalue2.boolean", false), true);
|
||||
|
||||
/* get list field elements */
|
||||
ASSERT_STREQ(conf.get_scalar<string>("base_value_2.sample_list[0]", "none").c_str(), "elem1");
|
||||
ASSERT_STREQ(conf.get_scalar<string>("base_value_2.sample_list[1]", "none").c_str(), "elem2");
|
||||
ASSERT_STREQ(conf.get_scalar<string>("base_value_2.sample_list[2]", "none").c_str(), "elem3");
|
||||
ASSERT_STREQ(conf.get_scalar<std::string>("base_value_2.sample_list[0]", "none").c_str(), "elem1");
|
||||
ASSERT_STREQ(conf.get_scalar<std::string>("base_value_2.sample_list[1]", "none").c_str(), "elem2");
|
||||
ASSERT_STREQ(conf.get_scalar<std::string>("base_value_2.sample_list[2]", "none").c_str(), "elem3");
|
||||
|
||||
/* get sequence */
|
||||
vector<string> seq;
|
||||
std::vector<std::string> seq;
|
||||
conf.get_sequence(seq, "base_value_2.sample_list");
|
||||
ASSERT_EQ(seq.size(), 3);
|
||||
ASSERT_STREQ(seq[0].c_str(), "elem1");
|
||||
@ -86,7 +86,7 @@ TEST(Configuration, read_yaml_fields)
|
||||
|
||||
TEST(Configuration, modify_yaml_fields)
|
||||
{
|
||||
string key = "base_value.subvalue.subvalue2.boolean";
|
||||
std::string key = "base_value.subvalue.subvalue2.boolean";
|
||||
yaml_helper conf;
|
||||
|
||||
/* Get original value */
|
||||
|
@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include "fields_info.h"
|
||||
|
||||
#include "actions.h"
|
||||
|
||||
using namespace falco::app;
|
||||
|
@ -116,7 +116,7 @@ void falco_configuration::load_yaml(const std::string& config_name, const yaml_h
|
||||
filename = config.get_scalar<std::string>("file_output.filename", "");
|
||||
if(filename == std::string(""))
|
||||
{
|
||||
throw logic_error("Error reading config file (" + config_name + "): file output enabled but no filename in configuration block");
|
||||
throw std::logic_error("Error reading config file (" + config_name + "): file output enabled but no filename in configuration block");
|
||||
}
|
||||
file_output.options["filename"] = filename;
|
||||
|
||||
@ -148,7 +148,7 @@ void falco_configuration::load_yaml(const std::string& config_name, const yaml_h
|
||||
program = config.get_scalar<std::string>("program_output.program", "");
|
||||
if(program == std::string(""))
|
||||
{
|
||||
throw logic_error("Error reading config file (" + config_name + "): program output enabled but no program in configuration block");
|
||||
throw std::logic_error("Error reading config file (" + config_name + "): program output enabled but no program in configuration block");
|
||||
}
|
||||
program_output.options["program"] = program;
|
||||
|
||||
@ -167,7 +167,7 @@ void falco_configuration::load_yaml(const std::string& config_name, const yaml_h
|
||||
|
||||
if(url == std::string(""))
|
||||
{
|
||||
throw logic_error("Error reading config file (" + config_name + "): http output enabled but no url in configuration block");
|
||||
throw std::logic_error("Error reading config file (" + config_name + "): http output enabled but no url in configuration block");
|
||||
}
|
||||
http_output.options["url"] = url;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user