Skip to content

Commit

Permalink
Intermittent fixes (#8380)
Browse files Browse the repository at this point in the history
* fix: remove useless accumulation of test variant

* fix: tighten the search conditions for variants

* add a test for get_test_variant method

---------

Co-authored-by: Olivier Giorgis <[email protected]>
  • Loading branch information
djangoliv and ogiorgis authored Dec 19, 2024
1 parent 1f352be commit 64516ab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions tests/intermittents_commenter/test_commenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,13 @@ def test_intermittents_commenter_with_failures(
with open("tests/intermittents_commenter/expected_comment_with_5_failures.text") as comment:
expected_comment = comment.read()
assert comment_params[0]["changes"]["comment"]["body"] == expected_comment


def test_get_test_variants(mock_test_variants_firefoxci_request):
process = Commenter(weekly_mode=True, dry_run=True)
test_suite = "mochitest-browser-chrome-spi-nw-10"
variants = process.get_test_variant(test_suite)
assert variants == "spi-nw"
test_suite = "mochitest-browser-chrome-2"
variants = process.get_test_variant(test_suite)
assert variants == "no_variant"
4 changes: 2 additions & 2 deletions treeherder/intermittents_commenter/commenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def generate_bug_changes(self, startday, endday, alt_startday, alt_endday):
change_whiteboard = None
priority = 0
rank = top_bugs.index(bug_id) + 1 if self.weekly_mode and bug_id in top_bugs else None
test_variants |= bug_stats[bug_id]["test_variants"]
test_variants = bug_stats[bug_id]["test_variants"]

if bugs_info and bug_id in bugs_info:
if self.weekly_mode:
Expand Down Expand Up @@ -353,7 +353,7 @@ def get_test_variant(self, test_suite):
base_symbol = test_suite
found_variants = []
for variant in variant_symbols:
if f"-{variant}" in base_symbol:
if f"-{variant}-" in base_symbol or base_symbol.endswith(variant):
found_variants.append(variant)
base_symbol = base_symbol.replace(f"-{variant}", "")
if not found_variants:
Expand Down

0 comments on commit 64516ab

Please sign in to comment.