Skip to content

Commit 28fc4af

Browse files
change reportablity logic to depend on the split load
1 parent f17e291 commit 28fc4af

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

choose_l10n_ci_set.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,21 @@ def save_mappings(selected_container):
7979
f.writelines(current_running_mappings)
8080

8181

82+
def select_l10n_mappings(beta_version):
83+
"""
84+
Select the correct l10n mappings.
85+
86+
Args:
87+
beta_version: the current beta version.
88+
"""
89+
beta_split = (beta_version % 3) + 1
90+
if os.path.exists(f"l10n_CM/beta_run_splits/l10n_split_{beta_split}.json"):
91+
with open(f"l10n_CM/beta_run_splits/l10n_split_{beta_split}.json", "r") as f:
92+
return json.load(f)
93+
else:
94+
return valid_l10n_mappings()
95+
96+
8297
if __name__ == "__main__":
8398
if os.path.exists(".env"):
8499
with open(".env") as fh:
@@ -106,12 +121,8 @@ def save_mappings(selected_container):
106121
# failsafe beta_version
107122
beta_version = 0
108123
# choose split number
109-
beta_version = (beta_version % 3) + 1
110-
l10n_mappings = valid_l10n_mappings()
124+
l10n_mappings = select_l10n_mappings(beta_version)
111125
sample_mappings = {k: v for k, v in l10n_mappings.items() if k.startswith("demo")}
112-
if os.path.exists(f"l10n_CM/beta_run_splits/l10n_split_{beta_version}.json"):
113-
with open(f"l10n_CM/beta_run_splits/l10n_split_{beta_version}.json", "r") as f:
114-
l10n_mappings = json.load(f)
115126
if os.environ.get("TESTRAIL_REPORT") or os.environ.get("MANUAL"):
116127
# Run all tests if this is a scheduled beta or a manual run
117128
save_mappings(l10n_mappings)

modules/testrail_integration.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import json
12
import logging
23
import os
34
import re
45
import subprocess
56
import sys
67

7-
from choose_l10n_ci_set import distribute_mappings_evenly, valid_l10n_mappings
8+
from choose_l10n_ci_set import select_l10n_mappings
89
from modules import taskcluster as tc
910
from modules import testrail as tr
1011
from modules.testrail import TestRail
@@ -187,11 +188,9 @@ def reportable(platform_to_test=None):
187188

188189
plan_entries = this_plan.get("entries")
189190
if os.environ.get("FX_L10N"):
190-
report = True
191191
beta_version = int(minor_num.split("b")[-1])
192-
distributed_mappings = distribute_mappings_evenly(
193-
valid_l10n_mappings(), beta_version
194-
)
192+
distributed_mappings = select_l10n_mappings(beta_version)
193+
expected_mappings = sum(map(lambda x: len(x), distributed_mappings.values()))
195194
covered_mappings = 0
196195
# keeping this logic to still see how many mappings are reported.
197196
for entry in plan_entries:
@@ -205,13 +204,11 @@ def reportable(platform_to_test=None):
205204
and platform in run_platform
206205
):
207206
covered_mappings += 1
208-
report = False
209207
logging.warning(
210-
f"Potentially matching run found for {platform}, may be reportable. (Found {covered_mappings} site/region mappings reported.)"
208+
f"Potentially matching run found for {platform}, may be reportable. (Found {covered_mappings} site/region mappings reported, expected {expected_mappings}.)"
211209
)
212-
logging.warning(f"Run is reportable: {report}")
213-
# Only report when there is a new beta and no other site/region mappings are reported.
214-
return report
210+
# Only report when there is a new beta without a reported plan or if the selected split is not completely reported.
211+
return covered_mappings < expected_mappings
215212
else:
216213
covered_suites = 0
217214
for entry in plan_entries:

0 commit comments

Comments
 (0)