| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import json | 5 import json |
| 6 import optparse | 6 import optparse |
| 7 | 7 |
| 8 from webkitpy.common.net.buildbot import Build | 8 from webkitpy.common.net.buildbot import Build |
| 9 from webkitpy.common.net.git_cl import GitCL | 9 from webkitpy.common.net.git_cl import GitCL |
| 10 from webkitpy.common.checkout.git_mock import MockGit | 10 from webkitpy.common.checkout.git_mock import MockGit |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 'INFO: MOCK Try Linux\n', | 290 'INFO: MOCK Try Linux\n', |
| 291 'INFO: MOCK Try Win\n', | 291 'INFO: MOCK Try Win\n', |
| 292 ]) | 292 ]) |
| 293 | 293 |
| 294 def test_builders_with_pending_builds(self): | 294 def test_builders_with_pending_builds(self): |
| 295 # A build number of None implies that a job has been started but not fin
ished yet. | 295 # A build number of None implies that a job has been started but not fin
ished yet. |
| 296 self.assertEqual( | 296 self.assertEqual( |
| 297 self.command.builders_with_pending_builds([Build('MOCK Try Linux', N
one), Build('MOCK Try Win', 123)]), | 297 self.command.builders_with_pending_builds([Build('MOCK Try Linux', N
one), Build('MOCK Try Win', 123)]), |
| 298 {'MOCK Try Linux'}) | 298 {'MOCK Try Linux'}) |
| 299 | 299 |
| 300 def test_builders_with_no_results(self): |
| 301 # In this example, Linux has a pending build, and Mac has no build. |
| 302 # MOCK Try Mac is listed because it's listed in the BuilderList in setUp
. |
| 303 self.assertEqual( |
| 304 self.command.builders_with_no_results([Build('MOCK Try Linux', None)
, Build('MOCK Try Win', 123)]), |
| 305 {'MOCK Try Mac', 'MOCK Try Linux'}) |
| 306 |
| 300 def test_bails_when_one_build_is_missing_results(self): | 307 def test_bails_when_one_build_is_missing_results(self): |
| 301 self.tool.buildbot.set_results(Build('MOCK Try Win', 5000), None) | 308 self.tool.buildbot.set_results(Build('MOCK Try Win', 5000), None) |
| 302 return_code = self.command.execute(self.command_options(), [], self.tool
) | 309 return_code = self.command.execute(self.command_options(), [], self.tool
) |
| 303 self.assertEqual(return_code, 1) | 310 self.assertEqual(return_code, 1) |
| 304 self.assertLog([ | 311 self.assertLog([ |
| 305 'ERROR: Failed to fetch results for: Build(builder_name=\'MOCK Try W
in\', build_number=5000)\n', | 312 'ERROR: Failed to fetch results for: Build(builder_name=\'MOCK Try W
in\', build_number=5000)\n', |
| 306 'ERROR: Results were expected to exist at:\n' | 313 'ERROR: Results were expected to exist at:\n' |
| 307 'https://storage.googleapis.com/chromium-layout-test-archives/MOCK_T
ry_Win/5000/layout-test-results/results.html\n', | 314 'https://storage.googleapis.com/chromium-layout-test-archives/MOCK_T
ry_Win/5000/layout-test-results/results.html\n', |
| 308 'ERROR: If the job failed, you could retry by running:\n' | 315 'ERROR: If the job failed, you could retry by running:\n' |
| 309 'git cl try -b MOCK Try Win\n' | 316 'git cl try -b MOCK Try Win\n' |
| 310 ]) | 317 ]) |
| 311 | 318 |
| 312 def test_bails_when_there_are_unstaged_baselines(self): | 319 def test_bails_when_there_are_unstaged_baselines(self): |
| 313 git = self.tool.git() | 320 git = self.tool.git() |
| 314 git.unstaged_changes = lambda: {'third_party/WebKit/LayoutTests/my-test-
expected.txt': '?'} | 321 git.unstaged_changes = lambda: {'third_party/WebKit/LayoutTests/my-test-
expected.txt': '?'} |
| 315 return_code = self.command.execute(self.command_options(), [], self.tool
) | 322 return_code = self.command.execute(self.command_options(), [], self.tool
) |
| 316 self.assertEqual(return_code, 1) | 323 self.assertEqual(return_code, 1) |
| 317 self.assertLog([ | 324 self.assertLog([ |
| 318 'ERROR: Aborting: there are unstaged baselines:\n', | 325 'ERROR: Aborting: there are unstaged baselines:\n', |
| 319 'ERROR: /mock-checkout/third_party/WebKit/LayoutTests/my-test-expe
cted.txt\n', | 326 'ERROR: /mock-checkout/third_party/WebKit/LayoutTests/my-test-expe
cted.txt\n', |
| 320 ]) | 327 ]) |
| OLD | NEW |