Skip to content

Commit efaa441

Browse files
authored
Fix intermittent commenter to increment failures instead of hardcode 1 (#8788)
1 parent 7411fd1 commit efaa441

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

tests/conftest.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,24 @@ def eleven_jobs_stored(test_repository, failure_classifications, hundred_job_blo
502502
store_job_data(test_repository, hundred_job_blobs)
503503

504504

505+
@pytest.fixture
506+
def five_intermittent_jobs(test_repository, hundred_job_blobs, create_jobs):
507+
"""make multiple failures for same platform/variant"""
508+
jobs = []
509+
for i in range(0, 5):
510+
# this allows every other task to repeat the job name
511+
if i % 2 == 0:
512+
name = hundred_job_blobs[i]["job"]["name"]
513+
514+
job = hundred_job_blobs[i]
515+
job["job"].update({"name": name})
516+
jobs.append(job)
517+
return create_jobs(jobs)[0]
518+
519+
520+
# store_job_data(test_repository, hundred_job_blobs[0:5])
521+
522+
505523
@pytest.fixture
506524
def taskcluster_jobs_stored(test_repository, sample_data):
507525
"""stores a list of TaskCluster job samples"""
@@ -1229,7 +1247,7 @@ def bug_data(eleven_jobs_stored, test_repository, test_push, bugs):
12291247

12301248

12311249
@pytest.fixture
1232-
def bug_data_with_5_failures(eleven_jobs_stored, test_repository, test_push, bugs):
1250+
def bug_data_with_5_failures(five_intermittent_jobs, test_repository, test_push, bugs):
12331251
jobs = th_models.Job.objects.all().order_by("id")
12341252
bug_id = bugs[0].bugzilla_id
12351253
for index, job in enumerate(jobs[:5]):

tests/intermittents_commenter/expected_comment_with_5_failures.text

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ This is the #1 most frequent failure this week.
55
* mozilla-central: 5
66

77
## Table
8-
| |**1proc**|**a11y_checks+swgl**|**no_variant**|**socketprocess_networking**|**spi-nw**|**swgl**|**swr**|
9-
|---|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
10-
|**linux1804-x86_64/debug**|1| |1| |1| | |
11-
|**macosx1015-x86_64/debug**| | | | |1| | |
12-
|**macosx1470-x86_64/debug**| | | | | | |1|
8+
| |**a11y_checks+swgl**|**no_variant**|**socketprocess_networking**|**spi-nw**|**swgl**|
9+
|---|:-:|:-:|:-:|:-:|:-:|
10+
|**linux1804-x86_64/debug**| |1| |2| |
11+
|**macosx1015-x86_64/debug**| | | |2| |
1312

1413
## For more details, see:
1514
https://treeherder.mozilla.org/intermittent-failures/bugdetails?bug=1&startday=2022-05-09&endday=2025-05-10&tree=all

treeherder/intermittents_commenter/commenter.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,11 @@ def build_bug_map(self, bugs, option_collection_map, start_day, end_day):
500500
data_table = bug_infos.data_table
501501
platform_and_build_data = data_table.get(platform_and_build, {})
502502
data_table[platform_and_build] = platform_and_build_data
503-
data_table[platform_and_build][test_variant] = {"count": 1, "runs": run_count}
503+
data_table[platform_and_build][test_variant] = {
504+
"count": platform_and_build_data.get(test_variant, {}).get("count", 0) + 1,
505+
"runs": run_count,
506+
}
507+
504508
return bug_map
505509

506510
def get_alt_date_bug_totals(self, startday, endday, bug_ids):

0 commit comments

Comments
 (0)