Skip to content

Commit 64516ab

Browse files
djangolivogiorgis
andauthored
Intermittent fixes (#8380)
* 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 <ogiorgis@logilab.fr>
1 parent 1f352be commit 64516ab

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

tests/intermittents_commenter/test_commenter.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,13 @@ def test_intermittents_commenter_with_failures(
8080
with open("tests/intermittents_commenter/expected_comment_with_5_failures.text") as comment:
8181
expected_comment = comment.read()
8282
assert comment_params[0]["changes"]["comment"]["body"] == expected_comment
83+
84+
85+
def test_get_test_variants(mock_test_variants_firefoxci_request):
86+
process = Commenter(weekly_mode=True, dry_run=True)
87+
test_suite = "mochitest-browser-chrome-spi-nw-10"
88+
variants = process.get_test_variant(test_suite)
89+
assert variants == "spi-nw"
90+
test_suite = "mochitest-browser-chrome-2"
91+
variants = process.get_test_variant(test_suite)
92+
assert variants == "no_variant"

treeherder/intermittents_commenter/commenter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def generate_bug_changes(self, startday, endday, alt_startday, alt_endday):
6565
change_whiteboard = None
6666
priority = 0
6767
rank = top_bugs.index(bug_id) + 1 if self.weekly_mode and bug_id in top_bugs else None
68-
test_variants |= bug_stats[bug_id]["test_variants"]
68+
test_variants = bug_stats[bug_id]["test_variants"]
6969

7070
if bugs_info and bug_id in bugs_info:
7171
if self.weekly_mode:
@@ -353,7 +353,7 @@ def get_test_variant(self, test_suite):
353353
base_symbol = test_suite
354354
found_variants = []
355355
for variant in variant_symbols:
356-
if f"-{variant}" in base_symbol:
356+
if f"-{variant}-" in base_symbol or base_symbol.endswith(variant):
357357
found_variants.append(variant)
358358
base_symbol = base_symbol.replace(f"-{variant}", "")
359359
if not found_variants:

0 commit comments

Comments
 (0)