Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/RedHatQE/firewatch into sup…
Browse files Browse the repository at this point in the history
…port_base_config
  • Loading branch information
oharan2 committed May 21, 2024
2 parents b87c6df + 2cf80ec commit da97ebd
Showing 1 changed file with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,6 @@ def test_configuration_gets_failure_rules_with_two_matching_steps(self):
"jira_project": "NONE",
},
)
different_type_rule = FailureRule(
rule_dict={
"step": "exact-failed-step",
"failure_type": "pod_failure",
"classification": "NONE",
"jira_project": "NONE",
},
)
pattern_rule = FailureRule(
rule_dict={
"step": "exact-*",
Expand All @@ -100,7 +92,7 @@ def test_configuration_gets_failure_rules_with_two_matching_steps(self):
"jira_project": "NONE",
},
)
rules = [pattern_rule, different_type_rule, match_rule]
rules = [pattern_rule, match_rule]

matching_rules = self.report.failure_matches_rule(
failure=failure,
Expand All @@ -109,8 +101,6 @@ def test_configuration_gets_failure_rules_with_two_matching_steps(self):
)
# Check if match_rule is sorted higher than pattern_rule
assert matching_rules[0].step.__eq__(failure.step)
# Eliminate the rule with the wrong failure_type
assert len(matching_rules) == 2

@patch.dict(
os.environ,
Expand Down Expand Up @@ -139,10 +129,10 @@ def test_configuration_gets_failure_rules_with_specific_step_prioritized_over_pa
default_jira_project=self.config.default_jira_project,
)

# Keep both rules in firewatch config since pattern might match other failures
assert len(matching_rules) == 2
# Check that the specific rule is prioritised on top of the pattern
assert matching_rules[0].step.__eq__("specific-step-logic")
# Keep both rules in firewatch config since pattern might match other failures
assert len(matching_rules) == 2

@patch.dict(
os.environ,
Expand Down Expand Up @@ -172,5 +162,5 @@ def test_configuration_gets_failure_rules_with_pattern_overriding_specific_step(
)

# Keep only the pattern rule by overriding the one from the base config file
assert len(matching_rules) == 1
assert matching_rules[0].step.__eq__("*step-logic*")
assert len(matching_rules) == 1

0 comments on commit da97ebd

Please sign in to comment.