Commit 772c82a3 authored by Robert Ma's avatar Robert Ma Committed by Commit Bot

[WPT export] Also notify "infrastructure/ tests" failures

And add more logging (consistent with other parts of wpt-export).

Change-Id: If2d1e2b6e80fe3600e2dc1b9ff63f11ec41f2018
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2559230Reviewed-by: default avatarStephen McGruer <smcgruer@chromium.org>
Commit-Queue: Robert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#831002}
parent f539af8d
......@@ -19,7 +19,8 @@ from blinkpy.w3c.wpt_github import GitHubError
_log = logging.getLogger(__name__)
RELEVANT_TASKCLUSTER_CHECKS = [
'wpt-chrome-dev-stability', 'wpt-firefox-nightly-stability', 'lint'
'wpt-chrome-dev-stability', 'wpt-firefox-nightly-stability', 'lint',
'infrastructure/ tests'
]
......@@ -93,11 +94,13 @@ class ExportNotifier(object):
_log.info('Processing %d CLs with failed Taskcluster checks.',
len(gerrit_dict))
for change_id, pr_status_info in gerrit_dict.items():
_log.info('Change-Id: %s', change_id)
try:
cl = self.gerrit.query_cl_comments_and_revisions(change_id)
has_commented = self.has_latest_taskcluster_status_commented(
cl.messages, pr_status_info)
if has_commented:
_log.info('Comment is up-to-date. Nothing to do here.')
continue
revision = cl.revisions.get(pr_status_info.gerrit_sha)
......@@ -131,6 +134,7 @@ class ExportNotifier(object):
cl_gerrit_sha = PRStatusInfo.get_gerrit_sha_from_comment(
message['message'])
if cl_gerrit_sha:
_log.debug('Found latest comment: %s', message['message'])
return cl_gerrit_sha == pr_status_info.gerrit_sha
return False
......
......@@ -78,12 +78,26 @@ class ExportNotifierTest(LoggingTestCase):
"conclusion": "failure",
"name": "wpt-firefox-nightly-stability"
},
{
"id": "3",
"conclusion": "failure",
"name": "lint"
},
{
"id": "4",
"conclusion": "failure",
"name": "infrastructure/ tests"
},
]
expected = {
'wpt-chrome-dev-stability':
'https://github.com/web-platform-tests/wpt/pull/123/checks?check_run_id=1',
'wpt-firefox-nightly-stability':
'https://github.com/web-platform-tests/wpt/pull/123/checks?check_run_id=2'
'https://github.com/web-platform-tests/wpt/pull/123/checks?check_run_id=2',
'lint':
'https://github.com/web-platform-tests/wpt/pull/123/checks?check_run_id=3',
'infrastructure/ tests':
'https://github.com/web-platform-tests/wpt/pull/123/checks?check_run_id=4',
}
self.assertEqual(
......@@ -294,7 +308,8 @@ class ExportNotifierTest(LoggingTestCase):
self.assertEqual(self.notifier.gerrit.request_posted, [])
self.assertLog([
'INFO: Processing 1 CLs with failed Taskcluster checks.\n',
'ERROR: Could not process Gerrit CL abc: Error from query_cl\n'
'INFO: Change-Id: abc\n',
'ERROR: Could not process Gerrit CL abc: Error from query_cl\n',
])
def test_export_notifier_success(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment