Skip to content

Commit

Permalink
cleanup(unit_test): refactor RuleLoaderReader setup a bit
Browse files Browse the repository at this point in the history
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
  • Loading branch information
incertum committed Aug 2, 2023
1 parent 7cfec03 commit 0bf3e59
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions unit_tests/engine/test_rule_loader_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ limitations under the License.
#include <falco/app/app.h>
#include "engine_helper.h"
#include <gtest/gtest.h>
#include "../falco/app/actions/app_action_helpers.h"

static std::shared_ptr<falco_engine> mock_engine()
{
Expand All @@ -34,9 +35,14 @@ static std::shared_ptr<falco_engine> mock_engine()

TEST(RuleLoaderReader, append_merge_override_enabled)
{
auto engine1 = mock_engine();
engine1->load_rules_file("../unit_tests/falco_rules_test1.yaml");
auto rules1 = engine1->get_rules();
falco::app::state s;
s.engine = mock_engine();
s.options.rules_filenames.push_back("../unit_tests/falco_rules_test1.yaml");

auto result = falco::app::actions::load_rules_files(s);
ASSERT_TRUE(result.success);

auto rules1 = s.engine->get_rules();
std::unordered_set<std::string> rules_names = {};
std::unordered_set<std::string> expected_rules_names = {"Dummy Rule 0", "Dummy Rule 1", \
"Dummy Rule 2", "Dummy Rule 4 Disabled", "Dummy Rule 5"};
Expand Down

0 comments on commit 0bf3e59

Please sign in to comment.