Esempio n. 1
0
  def testBuildSucceededButIsolateIsMissing(self, put, get_job_status):
    quest = find_isolate.FindIsolate(
        'Mac Builder', 'telemetry_perf_tests', 'luci.bucket')
    execution = quest.Start(change_test.Change(0))

    # Request a build.
    put.return_value = {'build': {'id': 'build_id'}}
    execution.Poll()

    # Check build status.
    get_job_status.return_value = {
        'build': {
            'status': 'COMPLETED',
            'result': 'SUCCESS',
            'result_details_json': """{
                "properties": {
                    "got_revision_cp": "refs/heads/master@{#123}",
                    "isolate_server": "https://isolate.server",
                    "swarm_hashes_refs/heads/master(at){#123}_without_patch": {}
                }
            }""",
        }
    }
    with self.assertRaises(errors.BuildIsolateNotFound):
      execution.Poll()
Esempio n. 2
0
 def testAllArguments(self):
   arguments = {
       'builder': 'Mac Builder',
       'target': 'telemetry_perf_tests',
   }
   expected = find_isolate.FindIsolate('Mac Builder', 'telemetry_perf_tests')
   self.assertEqual(find_isolate.FindIsolate.FromDict(arguments), expected)
Esempio n. 3
0
    def testSuccesfulBuilderLookupForAllBuilders(self):
        builder_testers = (
            ('arm-builder-rel', 'health-plan-clankium-phone'),
            ('Android Builder', 'Android Nexus5 Perf'),
            ('Android arm64 Builder', 'Android Nexus5X Perf'),
            ('Linux Builder', 'Linux Perf'),
            ('Mac Builder', 'Mac Air Perf'),
            ('Win Builder', 'Win 7 Perf'),
            ('Win x64 Builder', 'Win Zenbook Perf'),
        )

        change = change_module.Change((change_module.Commit('src',
                                                            'git hash'), ))
        isolate.Put(
            (builder, change, 'telemetry_perf_tests', hex(hash(builder)))
            for builder, _ in builder_testers)

        for builder, tester in builder_testers:
            quest = find_isolate.FindIsolate(tester, 'telemetry_perf_tests')
            execution = quest.Start(change)
            execution.Poll()

            self.assertExecutionSuccess(execution)
            self.assertEqual(execution.result_arguments,
                             {'isolate_hash': hex(hash(builder))})
Esempio n. 4
0
    def testBuildCanceled(self, put, get_job_status):
        change = change_module.Change(
            (change_module.Commit('src', 'base git hash'),
             change_module.Commit('v8', 'dep git hash')),
            patch=change_module.Patch('https://example.org', 2565263002,
                                      20001))
        quest = find_isolate.FindIsolate('Mac Pro Perf',
                                         'telemetry_perf_tests')
        execution = quest.Start(change)

        # Request a build.
        put.return_value = {'build': {'id': 'build_id'}}
        execution.Poll()

        # Check build status.
        get_job_status.return_value = {
            'build': {
                'status': 'COMPLETED',
                'result': 'CANCELED',
                'cancelation_reason': 'TIMEOUT',
            }
        }
        execution.Poll()

        self.assertExecutionFailure(execution, find_isolate.BuildError)
  def testSimultaneousBuilds(self, put, get_job_status):
    # Two builds started at the same time on the same Change should reuse the
    # same build request.
    change = change_module.Change(
        (change_module.Commit('src', 'base git hash'),))
    quest = find_isolate.FindIsolate('Mac Builder', 'telemetry_perf_tests')
    execution_1 = quest.Start(change)
    execution_2 = quest.Start(change)

    # Request a build.
    put.return_value = {'build': {'id': 'build_id'}}
    execution_1.Poll()
    execution_2.Poll()

    self.assertFalse(execution_1.completed)
    self.assertFalse(execution_2.completed)
    self.assertEqual(put.call_count, 1)

    # Check build status.
    get_job_status.return_value = {'build': {'status': 'STARTED'}}
    execution_1.Poll()
    execution_2.Poll()

    self.assertFalse(execution_1.completed)
    self.assertFalse(execution_2.completed)
    self.assertEqual(get_job_status.call_count, 2)

    # Look up isolate hash.
    isolate.Put((('Mac Builder', change,
                  'telemetry_perf_tests', 'isolate git hash'),))
    execution_1.Poll()
    execution_2.Poll()

    self.assertExecutionSuccess(execution_1)
    self.assertExecutionSuccess(execution_2)
Esempio n. 6
0
  def testBuildNoBucket(self, put, _):
    change = change_test.Change(123, 456, patch=True)
    quest = find_isolate.FindIsolate(
        'Mac Builder', 'telemetry_perf_tests', 'luci.bucket')
    execution = quest.Start(change)
    del execution._bucket

    # Request a build.
    put.return_value = {'build': {'id': 'build_id'}}
    execution.Poll()

    self.assertFalse(execution.completed)
    put.assert_called_once_with(
        find_isolate.BUCKET,
        [
            'buildset:patch/gerrit/codereview.com/567890/5',
            'buildset:commit/gitiles/chromium.googlesource.com/'
            'project/name/+/commit_123'
        ],
        {
            'builder_name': 'Mac Builder',
            'properties': {
                'clobber': True,
                'revision': 'commit_123',
                'deps_revision_overrides': {test.CATAPULT_URL: 'commit_456'},
                'patch_gerrit_url': 'https://codereview.com',
                'patch_issue': 567890,
                'patch_project': 'project/name',
                'patch_ref': 'refs/changes/90/567890/5',
                'patch_repository_url': test.CHROMIUM_URL,
                'patch_set': 5,
                'patch_storage': 'gerrit',
            }
        }
    )
Esempio n. 7
0
  def testIsolateLookupSuccess(self):
    quest = find_isolate.FindIsolate(
        'Mac Builder', 'telemetry_perf_tests', 'luci.bucket')

    # Propagate a thing that looks like a job.
    quest.PropagateJob(
        FakeJob('cafef00d', 'https://pinpoint/cafef00d', 'performance',
                '*****@*****.**'))

    execution = quest.Start(change_test.Change(123))
    execution.Poll()

    expected_result_arguments = {
        'isolate_server': 'https://isolate.server',
        'isolate_hash': '7c7e90be',
    }
    expected_as_dict = {
        'completed': True,
        'exception': None,
        'details': [
            {
                'key': 'builder',
                'value': 'Mac Builder',
            },
            {
                'key': 'isolate',
                'value': '7c7e90be',
                'url': 'https://isolate.server/browse?digest=7c7e90be',
            },
        ],
    }
    self.assertExecutionSuccess(execution)
    self.assertEqual(execution.result_values, ())
    self.assertEqual(execution.result_arguments, expected_result_arguments)
    self.assertEqual(execution.AsDict(), expected_as_dict)
    def testIsolateLookupSuccess(self):
        change = change_module.Change(
            (change_module.Commit('chromium', 'f9f2b720'), ))
        quest = find_isolate.FindIsolate('Mac Builder', 'telemetry_perf_tests')
        execution = quest.Start(change)
        execution.Poll()

        expected_result_arguments = {
            'isolate_server': 'https://isolate.server',
            'isolate_hash': '7c7e90be',
        }
        expected_as_dict = {
            'completed':
            True,
            'exception':
            None,
            'details': [
                {
                    'key': 'builder',
                    'value': 'Mac Builder',
                },
                {
                    'key': 'isolate',
                    'value': '7c7e90be',
                    'url': 'https://isolate.server/browse?digest=7c7e90be',
                },
            ],
        }
        self.assertExecutionSuccess(execution)
        self.assertEqual(execution.result_values, ())
        self.assertEqual(execution.result_arguments, expected_result_arguments)
        self.assertEqual(execution.AsDict(), expected_as_dict)
 def testAllArguments(self):
   arguments = {
       'configuration': 'chromium-rel-mac11-pro',
       'target': 'telemetry_perf_tests',
   }
   expected = find_isolate.FindIsolate('Mac Builder', 'telemetry_perf_tests')
   self.assertEqual(find_isolate.FindIsolate.FromDict(arguments),
                    (arguments, expected))
Esempio n. 10
0
    def testIsolateLookupSuccess(self):
        change = change_module.Change(change_module.Dep('src', 'f9f2b720'))
        execution = find_isolate.FindIsolate('Mac Pro Perf').Start(change)
        execution.Poll()

        self.assertExecutionSuccess(execution)
        self.assertEqual(execution.result_arguments,
                         {'isolate_hash': '7c7e90be'})
Esempio n. 11
0
    def testSimultaneousBuilds(self, put, get_job_status):
        # Two builds started at the same time on the same Change should reuse the
        # same build request.
        change = change_test.Change(0)
        quest = find_isolate.FindIsolate('Mac Builder', 'telemetry_perf_tests',
                                         'luci.bucket')
        execution_1 = quest.Start(change)
        execution_2 = quest.Start(change)

        # Request a build.
        put.return_value = {'build': {'id': 'build_id'}}
        execution_1.Poll()
        execution_2.Poll()

        self.assertFalse(execution_1.completed)
        self.assertFalse(execution_2.completed)
        self.assertEqual(put.call_count, 1)

        # Check build status.
        get_job_status.return_value = {'build': {'status': 'STARTED'}}
        execution_1.Poll()
        execution_2.Poll()

        self.assertFalse(execution_1.completed)
        self.assertFalse(execution_2.completed)
        self.assertEqual(get_job_status.call_count, 2)

        # Look up isolate hash.
        get_job_status.return_value = {
            'build': {
                'status':
                'COMPLETED',
                'result':
                'SUCCESS',
                'result_details_json':
                """{
                "properties": {
                    "got_revision_cp": "refs/heads/master@{#123}",
                    "isolate_server": "https://isolate.server",
                    "swarm_hashes_refs/heads/master(at){#123}_without_patch":
                        {"telemetry_perf_tests": "isolate git hash"}
                }
            }""",
            }
        }
        execution_1.Poll()
        execution_2.Poll()

        self.assertExecutionSuccess(execution_1)
        self.assertExecutionSuccess(execution_2)
Esempio n. 12
0
  def testBuildNoReviewUrl(self, put, _):
    change = change_test.Change(123, 456, patch=True)
    results = change.base_commit.AsDict()
    del results['review_url']
    change.base_commit.AsDict = mock.MagicMock(return_value=results)

    quest = find_isolate.FindIsolate(
        'Mac Builder', 'telemetry_perf_tests', 'luci.bucket')
    execution = quest.Start(change)
    del execution._bucket

    # Request a build.
    put.return_value = {'build': {'id': 'build_id'}}
    execution.Poll()

    self.assertExecutionFailure(execution, errors.BuildGerritUrlNotFound)
Esempio n. 13
0
  def testBuildSucceededButIsolateIsMissing(self, put, get_job_status):
    quest = find_isolate.FindIsolate('Mac Builder', 'telemetry_perf_tests')
    execution = quest.Start(change_test.Change(0))

    # Request a build.
    put.return_value = {'build': {'id': 'build_id'}}
    execution.Poll()

    # Check build status.
    get_job_status.return_value = {
        'build': {
            'status': 'COMPLETED',
            'result': 'SUCCESS',
        }
    }
    with self.assertRaises(find_isolate.IsolateNotFoundError):
      execution.Poll()
Esempio n. 14
0
    def testBuildLifecycle(self, put, get_job_status):
        change = change_module.Change(
            (change_module.Commit('src', 'base git hash'),
             change_module.Commit('v8', 'dep git hash')),
            patch=change_module.Patch('https://example.org', 2565263002,
                                      20001))
        quest = find_isolate.FindIsolate('Mac Pro Perf',
                                         'telemetry_perf_tests')
        execution = quest.Start(change)

        # Request a build.
        put.return_value = {'build': {'id': 'build_id'}}
        execution.Poll()

        self.assertFalse(execution.completed)
        put.assert_called_once_with(
            find_isolate.BUCKET, {
                'builder_name': 'Mac Builder',
                'properties': {
                    'clobber': True,
                    'parent_got_revision': 'base git hash',
                    'deps_revision_overrides': {
                        'https://chromium.googlesource.com/v8/v8':
                        'dep git hash',
                    },
                    'patch_storage': 'rietveld',
                    'rietveld': 'https://example.org',
                    'issue': 2565263002,
                    'patchset': 20001,
                }
            })

        # Check build status.
        get_job_status.return_value = {'build': {'status': 'STARTED'}}
        execution.Poll()

        self.assertFalse(execution.completed)
        get_job_status.assert_called_once_with('build_id')

        # Look up isolate hash.
        isolate.Put((('Mac Builder', change, 'telemetry_perf_tests',
                      'isolate git hash'), ))
        execution.Poll()

        self.assertExecutionSuccess(execution)
  def testIsolateLookupSuccess(self):
    change = change_module.Change((change_module.Commit('src', 'f9f2b720'),))
    quest = find_isolate.FindIsolate('Mac Builder', 'telemetry_perf_tests')
    execution = quest.Start(change)
    execution.Poll()

    self.assertExecutionSuccess(execution)
    self.assertEqual(execution.result_values, ())
    self.assertEqual(execution.result_arguments, {'isolate_hash': '7c7e90be'})
    self.assertEqual(
        {
            'completed': True,
            'exception': None,
            'details': {'build': None, 'builder': 'Mac Builder'},
            'result_arguments': {'isolate_hash': u'7c7e90be'},
            'result_values': (),
        },
        execution.AsDict())
Esempio n. 16
0
    def testIsolateLookupSuccess(self):
        change = change_module.Change(change_module.Dep('src', 'f9f2b720'))
        quest = find_isolate.FindIsolate('Mac Pro Perf',
                                         'telemetry_perf_tests')
        execution = quest.Start(change)
        execution.Poll()

        self.assertExecutionSuccess(execution)
        self.assertEqual(execution.result_arguments,
                         {'isolate_hash': '7c7e90be'})
        self.assertEqual(
            {
                'build': None,
                'result_arguments': {
                    'isolate_hash': u'7c7e90be'
                },
                'result_values': (None, )
            }, execution.AsDict())
Esempio n. 17
0
  def testBuildCanceled(self, put, get_job_status):
    quest = find_isolate.FindIsolate('Mac Builder', 'telemetry_perf_tests')
    execution = quest.Start(change_test.Change(0))

    # Request a build.
    put.return_value = {'build': {'id': 'build_id'}}
    execution.Poll()

    # Check build status.
    get_job_status.return_value = {
        'build': {
            'status': 'COMPLETED',
            'result': 'CANCELED',
            'cancelation_reason': 'TIMEOUT',
        }
    }
    execution.Poll()

    self.assertExecutionFailure(execution, find_isolate.BuildError)
  def testBuildSucceededButIsolateIsMissing(self, put, get_job_status):
    change = change_module.Change(
        (change_module.Commit('src', 'base git hash'),))
    quest = find_isolate.FindIsolate('Mac Builder', 'telemetry_perf_tests')
    execution = quest.Start(change)

    # Request a build.
    put.return_value = {'build': {'id': 'build_id'}}
    execution.Poll()

    # Check build status.
    get_job_status.return_value = {
        'build': {
            'status': 'COMPLETED',
            'result': 'SUCCESS',
        }
    }
    execution.Poll()

    self.assertExecutionFailure(execution, find_isolate.BuildError)
Esempio n. 19
0
  def testBuildFailure(self, put, get_job_status):
    quest = find_isolate.FindIsolate(
        'Mac Builder', 'telemetry_perf_tests', 'luci.bucket')
    execution = quest.Start(change_test.Change(0))

    # Request a build.
    put.return_value = {'build': {'id': 'build_id'}}
    execution.Poll()

    # Check build status.
    get_job_status.return_value = {
        'build': {
            'status': 'COMPLETED',
            'result': 'FAILURE',
            'failure_reason': 'BUILD_FAILURE',
        }
    }
    execution.Poll()

    self.assertExecutionFailure(execution, errors.BuildFailed)
    def testBuildFailure(self, put, get_job_status):
        change = change_module.Change(
            (change_module.Commit('chromium', 'base git hash'), ))
        quest = find_isolate.FindIsolate('Mac Builder', 'telemetry_perf_tests')
        execution = quest.Start(change)

        # Request a build.
        put.return_value = {'build': {'id': 'build_id'}}
        execution.Poll()

        # Check build status.
        get_job_status.return_value = {
            'build': {
                'status': 'COMPLETED',
                'result': 'FAILURE',
                'failure_reason': 'BUILD_FAILURE',
            }
        }
        execution.Poll()

        self.assertExecutionFailure(execution, find_isolate.BuildError)
Esempio n. 21
0
    def testBuildSucceededButIsolateIsMissing(self, put, get_job_status):
        change = change_module.Change(
            change_module.Dep('src', 'base git hash'),
            (change_module.Dep('v8', 'dep git hash'), ),
            patch=change_module.Patch('https://example.org', 2565263002,
                                      20001))
        execution = find_isolate.FindIsolate('Mac Pro Perf').Start(change)

        # Request a build.
        put.return_value = {'build': {'id': 'build_id'}}
        execution.Poll()

        # Check build status.
        get_job_status.return_value = {
            'build': {
                'status': 'COMPLETED',
                'result': 'SUCCESS',
            }
        }
        execution.Poll()

        self.assertExecutionFailure(execution, find_isolate.BuildError)
    def testBuildLifecycle(self, build_parameters, put, get_job_status):
        change = change_module.Change(
            (change_module.Commit('chromium', 'base git hash'),
             change_module.Commit('catapult', 'dep git hash')),
            patch=change_module.GerritPatch('https://example.org', 672011,
                                            '2f0d'))
        quest = find_isolate.FindIsolate('Mac Builder', 'telemetry_perf_tests')
        execution = quest.Start(change)

        # Request a build.
        build_parameters.return_value = {'patch_storage': 'gerrit'}
        put.return_value = {'build': {'id': 'build_id'}}
        execution.Poll()

        self.assertFalse(execution.completed)
        put.assert_called_once_with(
            find_isolate.BUCKET, {
                'builder_name': 'Mac Builder',
                'properties': {
                    'clobber': True,
                    'parent_got_revision': 'base git hash',
                    'deps_revision_overrides': {
                        test.CATAPULT_URL: 'dep git hash'
                    },
                    'patch_storage': 'gerrit',
                }
            })

        # Check build status.
        get_job_status.return_value = {
            'build': {
                'status': 'STARTED',
                'url': 'build_url',
            }
        }
        execution.Poll()

        self.assertFalse(execution.completed)
        get_job_status.assert_called_once_with('build_id')

        # Look up isolate hash.
        isolate.Put('https://isolate.server',
                    (('Mac Builder', change, 'telemetry_perf_tests',
                      'isolate git hash'), ))
        execution.Poll()

        expected_result_arguments = {
            'isolate_server': 'https://isolate.server',
            'isolate_hash': 'isolate git hash',
        }
        expected_as_dict = {
            'completed':
            True,
            'exception':
            None,
            'details': [
                {
                    'key': 'builder',
                    'value': 'Mac Builder',
                },
                {
                    'key': 'build',
                    'value': 'build_id',
                    'url': 'build_url',
                },
                {
                    'key': 'isolate',
                    'value': 'isolate git hash',
                    'url':
                    'https://isolate.server/browse?digest=isolate git hash',
                },
            ],
        }
        self.assertExecutionSuccess(execution)
        self.assertEqual(execution.result_values, ())
        self.assertEqual(execution.result_arguments, expected_result_arguments)
        self.assertEqual(execution.AsDict(), expected_as_dict)
Esempio n. 23
0
 def testUnknownBuilder(self):
     with self.assertRaises(NotImplementedError):
         find_isolate.FindIsolate('Unix Perf')
Esempio n. 24
0
  def testBuildLifecycle(self, put, get_job_status):
    change = change_test.Change(123, 456, patch=True)
    quest = find_isolate.FindIsolate(
        'Mac Builder', 'telemetry_perf_tests', 'luci.bucket')
    execution = quest.Start(change)

    # Request a build.
    put.return_value = {'build': {'id': 'build_id'}}
    execution.Poll()

    self.assertFalse(execution.completed)
    put.assert_called_once_with(
        'luci.bucket',
        [
            'buildset:patch/gerrit/codereview.com/567890/5',
            'buildset:commit/gitiles/chromium.googlesource.com/'
            'project/name/+/commit_123',
        ],
        {
            'builder_name': 'Mac Builder',
            'properties': {
                'clobber': True,
                'revision': 'commit_123',
                'deps_revision_overrides': {test.CATAPULT_URL: 'commit_456'},
                'patch_gerrit_url': 'https://codereview.com',
                'patch_issue': 567890,
                'patch_project': 'project/name',
                'patch_ref': 'refs/changes/90/567890/5',
                'patch_repository_url': test.CHROMIUM_URL,
                'patch_set': 5,
                'patch_storage': 'gerrit',
            }
        }
    )

    # Check build status.
    get_job_status.return_value = {'build': {
        'status': 'STARTED',
        'url': 'build_url',
    }}
    execution.Poll()

    self.assertFalse(execution.completed)
    get_job_status.assert_called_once_with('build_id')

    # Look up isolate hash.
    get_job_status.return_value = {
        'build': {
            'status': 'COMPLETED',
            'result': 'SUCCESS',
            'url': 'build_url',
            'result_details_json': """{
                "properties": {
                    "got_revision_cp": "refs/heads/master@{#123}",
                    "isolate_server": "https://isolate.server",
                    "swarm_hashes_refs/heads/master(at){#123}_without_patch":
                        {"telemetry_perf_tests": "isolate git hash"}
                }
            }""",
        }
    }
    execution.Poll()

    expected_result_arguments = {
        'isolate_server': 'https://isolate.server',
        'isolate_hash': 'isolate git hash',
    }
    expected_as_dict = {
        'completed': True,
        'exception': None,
        'details': [
            {
                'key': 'builder',
                'value': 'Mac Builder',
            },
            {
                'key': 'build',
                'value': 'build_id',
                'url': 'build_url',
            },
            {
                'key': 'isolate',
                'value': 'isolate git hash',
                'url': 'https://isolate.server/browse?digest=isolate git hash',
            },
        ],
    }
    self.assertExecutionSuccess(execution)
    self.assertEqual(execution.result_values, ())
    self.assertEqual(execution.result_arguments, expected_result_arguments)
    self.assertEqual(execution.AsDict(), expected_as_dict)
Esempio n. 25
0
  def testBuildLifecycle(self, put, get_job_status):
    change = change_test.Change(123, 456, patch=True)
    quest = find_isolate.FindIsolate('Mac Builder', 'telemetry_perf_tests')
    execution = quest.Start(change)

    # Request a build.
    put.return_value = {'build': {'id': 'build_id'}}
    execution.Poll()

    self.assertFalse(execution.completed)
    put.assert_called_once_with(find_isolate.BUCKET, {
        'builder_name': 'Mac Builder',
        'properties': {
            'clobber': True,
            'parent_got_revision': 'commit_123',
            'deps_revision_overrides': {test.CATAPULT_URL: 'commit_456'},
            'patch_gerrit_url': 'https://codereview.com',
            'patch_issue': 567890,
            'patch_project': 'project/name',
            'patch_ref': 'refs/changes/90/567890/5',
            'patch_repository_url': test.CHROMIUM_URL,
            'patch_set': 5,
            'patch_storage': 'gerrit',
        }
    })

    # Check build status.
    get_job_status.return_value = {'build': {
        'status': 'STARTED',
        'url': 'build_url',
    }}
    execution.Poll()

    self.assertFalse(execution.completed)
    get_job_status.assert_called_once_with('build_id')

    # Look up isolate hash.
    isolate.Put((
        ('Mac Builder', change, 'telemetry_perf_tests',
         'https://isolate.server', 'isolate git hash'),
    ))
    execution.Poll()

    expected_result_arguments = {
        'isolate_server': 'https://isolate.server',
        'isolate_hash': 'isolate git hash',
    }
    expected_as_dict = {
        'completed': True,
        'exception': None,
        'details': [
            {
                'key': 'builder',
                'value': 'Mac Builder',
            },
            {
                'key': 'build',
                'value': 'build_id',
                'url': 'build_url',
            },
            {
                'key': 'isolate',
                'value': 'isolate git hash',
                'url': 'https://isolate.server/browse?digest=isolate git hash',
            },
        ],
    }
    self.assertExecutionSuccess(execution)
    self.assertEqual(execution.result_values, ())
    self.assertEqual(execution.result_arguments, expected_result_arguments)
    self.assertEqual(execution.AsDict(), expected_as_dict)