Beispiel #1
0
 def test_try_job_results_with_task_id_in_url(self):
     git_cl = GitCL(MockHost())
     git_cl.fetch_raw_try_job_results = lambda **_: [
         {
             'builder_name':
             'builder-a',
             'status':
             'COMPLETED',
             'result':
             'FAILURE',
             'failure_reason':
             'BUILD_FAILURE',
             'url': ('https://ci.chromium.org/swarming/task/'
                     '36a767f405d9ee10'),
         },
         {
             'builder_name':
             'builder-b',
             'status':
             'COMPLETED',
             'result':
             'SUCCESS',
             'url': ('https://ci.chromium.org/swarming/task/'
                     '38740befcd9c0010?server=chromium-swarm.appspot.com'),
         },
     ]
     self.assertEqual(
         git_cl.try_job_results(), {
             Build('builder-a', '36a767f405d9ee10'):
             TryJobStatus('COMPLETED', 'FAILURE'),
             Build('builder-b', '38740befcd9c0010'):
             TryJobStatus('COMPLETED', 'SUCCESS'),
         })
Beispiel #2
0
 def test_try_job_results_with_unexpected_url_format(self):
     git_cl = GitCL(MockHost())
     git_cl.fetch_raw_try_job_results = lambda **_: [
         {
             'builder_name': 'builder-a',
             'status': 'COMPLETED',
             'result': 'FAILURE',
             'failure_reason': 'BUILD_FAILURE',
             'url': 'https://example.com/',
         },
     ]
     # We try to parse a build number or task ID from the URL.
     with self.assertRaisesRegexp(AssertionError, 'https://example.com/ did not match expected format'):
         git_cl.try_job_results()
     # We ignore builders that we explicitly don't care about;
     # so if we only care about other-builder, not builder-a,
     # then no exception is raised.
     self.assertEqual(git_cl.try_job_results(['other-builder']), {})
 def test_try_job_results_with_task_id_in_url(self):
     git_cl = GitCL(MockHost())
     git_cl.fetch_raw_try_job_results = lambda: [
         {
             'builder_name':
             'builder-a',
             'status':
             'COMPLETED',
             'result':
             'FAILURE',
             'failure_reason':
             'BUILD_FAILURE',
             'url':
             'https://luci-milo.appspot.com/swarming/task/36a767f405d9ee10',
         },
     ]
     self.assertEqual(
         git_cl.try_job_results(), {
             Build('builder-a', '36a767f405d9ee10'):
             TryJobStatus('COMPLETED', 'FAILURE')
         })