Commit 1e665d5f authored by Robert Ma's avatar Robert Ma Committed by Commit Bot

[WPT import] Handle CQ+2 failures

Sometimes CQ+2 can fail even when CQ+1 succeeds (e.g. last-minute merge
conflicts). This CL catches this failure properly.

Bug: 817025
Change-Id: Ic6679a7b4797132abd3ecae348644d6e14f73c7c
Reviewed-on: https://chromium-review.googlesource.com/1079889Reviewed-by: default avatarQuinten Yearsley <qyearsley@chromium.org>
Commit-Queue: Robert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563007}
parent c7ca97d0
......@@ -245,16 +245,21 @@ class TestImporter(object):
self.git_cl.run(['set-close'])
return False
if self.git_cl.all_success(cq_try_results):
_log.info('CQ appears to have passed; trying to commit.')
self.git_cl.run(['upload', '-f', '--send-mail']) # Turn off WIP mode.
self.git_cl.run(['set-commit'])
self.git_cl.wait_for_closed_status()
if not self.git_cl.all_success(cq_try_results):
_log.error('CQ appears to have failed; aborting.')
self.git_cl.run(['set-close'])
return False
_log.info('CQ appears to have passed; trying to commit.')
self.git_cl.run(['upload', '-f', '--send-mail']) # Turn off WIP mode.
self.git_cl.run(['set-commit'])
if self.git_cl.wait_for_closed_status():
_log.info('Update completed.')
return True
_log.error('Cannot submit CL; aborting.')
self.git_cl.run(['set-close'])
_log.error('CQ appears to have failed; aborting.')
return False
def blink_try_bots(self):
......
......@@ -109,7 +109,7 @@ class TestImporterTest(LoggingTestCase):
['git', 'cl', 'set-commit'],
])
def test_run_commit_queue_for_cl_fails(self):
def test_run_commit_queue_for_cl_fail_cq(self):
host = MockHost()
host.filesystem.write_text_file(
'/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations', '')
......@@ -132,6 +132,32 @@ class TestImporterTest(LoggingTestCase):
['git', 'cl', 'set-close'],
])
def test_run_commit_queue_for_cl_fail_to_land(self):
host = MockHost()
host.filesystem.write_text_file(
'/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations', '')
importer = TestImporter(host)
# Only the latest job for each builder is counted.
importer.git_cl = MockGitCL(host, status='lgtm', try_job_results={
Build('cq-builder-a', 120): TryJobStatus('COMPLETED', 'FAILURE'),
Build('cq-builder-a', 123): TryJobStatus('COMPLETED', 'SUCCESS'),
})
importer.git_cl.wait_for_closed_status = lambda: False
success = importer.run_commit_queue_for_cl()
self.assertFalse(success)
self.assertLog([
'INFO: Triggering CQ try jobs.\n',
'INFO: All jobs finished.\n',
'INFO: CQ appears to have passed; trying to commit.\n',
'ERROR: Cannot submit CL; aborting.\n',
])
self.assertEqual(importer.git_cl.calls, [
['git', 'cl', 'try'],
['git', 'cl', 'upload', '-f', '--send-mail'],
['git', 'cl', 'set-commit'],
['git', 'cl', 'set-close'],
])
def test_run_commit_queue_for_cl_closed_cl(self):
host = MockHost()
host.filesystem.write_text_file(
......
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