Skip to content

Commit

Permalink
[processor] Infer the channel label from reports
Browse files Browse the repository at this point in the history
When the uploader does not provide a channel label, the processor will
now set it based on a new property in the report,
`run_info.browser_channel`, introduced in
web-platform-tests/wpt#12679 .

A new channel label, "beta", is also introduced in this commit, since we
now have beta browsers running on Taskcluster daily.
  • Loading branch information
Hexcles committed Sep 12, 2018
1 parent da23f19 commit 9521c10
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
23 changes: 19 additions & 4 deletions results-processor/wptreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@

DEFAULT_PROJECT = 'wptdashboard'
GCS_PUBLIC_DOMAIN = 'https://storage.googleapis.com'
CHANNEL_TO_LABEL = {
'release': 'stable',
'stable': 'stable',
'beta': 'beta',
'dev': 'experimental',
'experimental': 'experimental',
'nightly': 'experimental',
'preview': 'experimental',
}

_log = logging.getLogger(__name__)

Expand Down Expand Up @@ -429,8 +438,7 @@ def prepare_labels(report, labels_str, uploader):
The following labels will be automatically added:
* The name of the uploader
* The name of the browser
* "stable" (as in release channels), if neither "stable" or "experimental"
is provided by the uploader.
* The release channel of the browser (if the uploader doesn't provide one)
Args:
report: A WPTReport.
Expand All @@ -446,8 +454,15 @@ def prepare_labels(report, labels_str, uploader):
# Empty labels may be generated here, but they will be removed later.
for label in labels_str.split(','):
labels.add(label.strip())
if ('stable' not in labels) and ('experimental' not in labels):
labels.add('stable')

# Add the release channel label.
if not any([i in labels for i in set(CHANNEL_TO_LABEL.values())]):
if report.run_info.get('browser_channel') in CHANNEL_TO_LABEL:
labels.add(CHANNEL_TO_LABEL[report.run_info['browser_channel']])
else:
# Default to "stable".
labels.add('stable')

# Remove any empty labels.
if '' in labels:
labels.remove('')
Expand Down
5 changes: 5 additions & 0 deletions results-processor/wptreport_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,3 +505,8 @@ def test_prepare_labels_from_browser_channel(self):
prepare_labels(r, '', 'blade-runner'),
['blade-runner', 'experimental', 'firefox']
)
r._report['run_info']['browser_channel'] = 'beta'
self.assertListEqual(
prepare_labels(r, '', 'blade-runner'),
['beta', 'blade-runner', 'firefox']
)

0 comments on commit 9521c10

Please sign in to comment.