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 8dac89f
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,32 @@ 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*")

def test_configuration_gets_failure_rules_with_two_matching_steps(self):
failure = Failure(failed_step="exact-failed-step", failure_type="test_failure")

match_rule = FailureRule(
rule_dict={
"step": "exact-failed-step",
"failure_type": "test_failure",
"classification": "NONE",
"jira_project": "NONE",
},
)
pattern_rule = FailureRule(
rule_dict={
"step": "exact-*",
"failure_type": "test_failure",
"classification": "NONE",
"jira_project": "NONE",
},
)
rules = [pattern_rule, match_rule]

matching_rules = self.report.failure_matches_rule(
failure=failure,
rules=rules,
default_jira_project=self.config.default_jira_project,
)
# Check if match_rule is sorted higher than pattern_rule
assert matching_rules[0].step.__eq__(failure.step)

0 comments on commit 8dac89f

Please sign in to comment.