Пример #1
0
  def testMidpointRaisesAcrossDepsRollWhenDepAlreadyOverridden(
      self, commit_range, file_contents):
    def _CommitRange(repository_url, first_git_hash, last_git_hash):
      del repository_url
      if first_git_hash == '0e57e2b' and last_git_hash == 'babe852':
        return [{'commit': 'babe852'}]
      if first_git_hash == '1111111' and last_git_hash == '3333333':
        return [{'commit': '3333333'}, {'commit': '2222222'}]
      raise NotImplementedError()
    commit_range.side_effect = _CommitRange

    def _FileContents(repository_url, git_hash, path):
      del repository_url
      del path
      if git_hash == '0e57e2b':
        return 'deps = {"src/catapult": "%s@0000000"}' % _CATAPULT_URL
      if git_hash == 'babe852':
        return 'deps = {"src/catapult": "%s@4444444"}' % _CATAPULT_URL
      raise NotImplementedError()
    file_contents.side_effect = _FileContents

    change_a = change.Change(change.Dep('src', '0e57e2b'),
                             (change.Dep('catapult', '1111111'),))
    change_b = change.Change(change.Dep('src', 'babe852'),
                             (change.Dep('catapult', '3333333'),))

    with self.assertRaises(change.NonLinearError):
      change.Change.Midpoint(change_a, change_b)
Пример #2
0
 def testCompletedDoesNotReassign(
     self, differences, result_values, patch_as_dict):
   commits = (change.Commit('chromium', 'git_hash'),)
   patch = change.GerritPatch('https://codereview.com', 672011, '2f0d5c7')
   c = change.Change(commits, patch)
   c = change.Change(commits, patch)
   differences.return_value = [(None, c)]
   result_values.side_effect = [40], [20]
   patch_as_dict.return_value = {
       'url': 'https://codereview.com/c/672011/2f0d5c7',
       'author': '*****@*****.**',
       'subject': 'Subject.',
       'message': 'Subject.\n\nCommit message.',
   }
   self.get_issue.return_value = {'status': 'Assigned'}
   j = job.Job.New((), (), bug_id=123456, comparison_mode='performance')
   j.Run()
   self.ExecuteDeferredTasks('default')
   self.assertFalse(j.failed)
   self.add_bug_comment.assert_called_once_with(
       123456,
       _COMMENT_COMPLETED_WITH_PATCH,
       owner=None,
       status=None,
       cc_list=['*****@*****.**'],
       labels=['Pinpoint-Culprit-Found'],
       merge_issue=None,
       project='chromium')
Пример #3
0
  def testMidpointWithDepsRoll(self, commit_range, file_contents):
    def _CommitRange(repository_url, first_git_hash, last_git_hash):
      del repository_url
      if first_git_hash == '0e57e2b' and last_git_hash == 'babe852':
        return [{'commit': 'babe852'}]
      if first_git_hash == '0000000' and last_git_hash == '2222222':
        return [{'commit': '2222222'}, {'commit': '1111111'}]
      raise NotImplementedError()
    commit_range.side_effect = _CommitRange

    def _FileContents(repository_url, git_hash, path):
      del repository_url
      del path
      if git_hash == '0e57e2b':
        return 'deps = {"src/catapult": "%s@0000000"}' % _CATAPULT_URL
      if git_hash == 'babe852':
        return 'deps = {"src/catapult": "%s@2222222"}' % _CATAPULT_URL
      raise NotImplementedError()
    file_contents.side_effect = _FileContents

    change_a = change.Change(change.Dep('src', '0e57e2b'))
    change_b = change.Change(change.Dep('src', 'babe852'))
    expected = change.Change(change.Dep('src', '0e57e2b'),
                             (change.Dep('catapult', '1111111'),))

    self.assertEqual(change.Change.Midpoint(change_a, change_b), expected)
Пример #4
0
 def testMidpointRaisesWithMultipleDifferingCommits(self):
     change_a = change.Change(change.Dep('chromium/src', '0e57e2b'),
                              (change.Dep('catapult', 'e0a2efb'), ))
     change_b = change.Change(change.Dep('chromium/src', 'babe852'),
                              (change.Dep('catapult', 'bfa19de'), ))
     with self.assertRaises(change.NonLinearError):
         change.Change.Midpoint(change_a, change_b)
Пример #5
0
def _ValidateChanges(comparison_mode, arguments):
    changes = arguments.get('changes')
    if changes:
        # FromData() performs input validation.
        return [change.Change.FromData(c) for c in json.loads(changes)]

    # Currently we only want try job support compare BASE and BASE+PATH
    # So override start and end to ensure they are same
    if comparison_mode == job_state.TRY:
        arguments['start_git_hash'] = arguments['base_git_hash']
        arguments['end_git_hash'] = arguments['base_git_hash']

    commit_1 = change.Commit.FromDict({
        'repository':
        arguments.get('repository'),
        'git_hash':
        arguments.get('start_git_hash'),
    })

    commit_2 = change.Commit.FromDict({
        'repository':
        arguments.get('repository'),
        'git_hash':
        arguments.get('end_git_hash'),
    })

    if 'patch' in arguments:
        patch = change.GerritPatch.FromUrl(arguments['patch'])
    else:
        patch = None

    change_1 = change.Change(commits=(commit_1, ))
    change_2 = change.Change(commits=(commit_2, ), patch=patch)

    return change_1, change_2
Пример #6
0
  def testCompletedMultipleDifferences(self, differences, commit_as_dict):
    c1 = change.Change((change.Commit('chromium', 'git_hash_1'),))
    c2 = change.Change((change.Commit('chromium', 'git_hash_2'),))
    differences.return_value = [(1, c1), (2, c2)]
    commit_as_dict.side_effect = (
        {
            'repository': 'chromium',
            'git_hash': 'git_hash_1',
            'author': '*****@*****.**',
            'subject': 'Subject.',
            'reviewers': ['*****@*****.**'],
            'url': 'https://example.com/repository/+/git_hash_1',
        },
        {
            'repository': 'chromium',
            'git_hash': 'git_hash_2',
            'author': '*****@*****.**',
            'subject': 'Subject.',
            'reviewers': ['*****@*****.**', '*****@*****.**'],
            'url': 'https://example.com/repository/+/git_hash_2',
        },
    )

    j = job.Job.New({}, [], False, bug_id=123456)
    j.put()
    j.Run()

    self.add_bug_comment.assert_called_once_with(
        123456, _COMMENT_COMPLETED_TWO_DIFFERENCES,
        status='Assigned', owner='*****@*****.**',
        cc_list=['*****@*****.**', '*****@*****.**',
                 '*****@*****.**', '*****@*****.**'])
Пример #7
0
    def testCompletedDoesNotReassign(self, differences, result_values,
                                     patch_as_dict):
        commits = (change.Commit('chromium', 'git_hash'), )
        patch = change.GerritPatch('https://codereview.com', 672011, '2f0d5c7')
        c = change.Change(commits, patch)
        c = change.Change(commits, patch)
        differences.return_value = [(None, c)]
        result_values.side_effect = [0], [1.23456]
        patch_as_dict.return_value = {
            'author': '*****@*****.**',
            'subject': 'Subject.',
            'url': 'https://codereview.com/c/672011/2f0d5c7',
            'git_hash': 'abc123'
        }

        self.get_issue.return_value = {'status': 'Assigned'}

        j = job.Job.New((), (), bug_id=123456, comparison_mode='performance')
        j.Run()

        self.add_bug_comment.assert_called_once_with(
            123456,
            _COMMENT_COMPLETED_WITH_PATCH,
            cc_list=['*****@*****.**'],
            merge_issue=None)
Пример #8
0
    def testCompletedMultipleDifferences(self, differences, commit_as_dict):
        c1 = change.Change((change.Commit('chromium', 'git_hash_1'), ))
        c2 = change.Change((change.Commit('chromium', 'git_hash_2'), ))
        differences.return_value = [(None, c1, [0], []), (None, c2, [], [2])]
        commit_as_dict.side_effect = (
            {
                'repository': 'chromium',
                'git_hash': 'git_hash_1',
                'author': '*****@*****.**',
                'subject': 'Subject.',
                'url': 'https://example.com/repository/+/git_hash_1',
            },
            {
                'repository': 'chromium',
                'git_hash': 'git_hash_2',
                'author': '*****@*****.**',
                'subject': 'Subject.',
                'url': 'https://example.com/repository/+/git_hash_2',
            },
        )

        self.get_issue.return_value = {'status': 'Untriaged'}

        j = job.Job.New((), (), bug_id=123456, comparison_mode='performance')
        j.Run()

        self.add_bug_comment.assert_called_once_with(
            123456,
            _COMMENT_COMPLETED_TWO_DIFFERENCES,
            status='Assigned',
            owner='*****@*****.**',
            cc_list=['*****@*****.**', '*****@*****.**'])
Пример #9
0
 def testMidpointRaisesWithDifferingPatch(self):
   change_a = change.Change(change.Dep('src', '0e57e2b'))
   change_b = change.Change(
       change.Dep('src', 'babe852'),
       patch=change.Patch('https://codereview.chromium.org', 2565263002, 20001))
   with self.assertRaises(change.NonLinearError):
     change.Change.Midpoint(change_a, change_b)
Пример #10
0
def _ValidateChanges(arguments):
  changes = arguments.get('changes')
  if changes:
    # FromData() performs input validation.
    return [change.Change.FromData(c) for c in json.loads(changes)]

  commit_1 = change.Commit.FromDict({
      'repository': arguments.get('repository'),
      'git_hash': arguments.get('start_git_hash'),
  })

  commit_2 = change.Commit.FromDict({
      'repository': arguments.get('repository'),
      'git_hash': arguments.get('end_git_hash'),
  })

  if 'patch' in arguments:
    patch = change.GerritPatch.FromUrl(arguments['patch'])
  else:
    patch = None

  change_1 = change.Change(commits=(commit_1,))
  change_2 = change.Change(commits=(commit_2,), patch=patch)

  return change_1, change_2
Пример #11
0
    def testCompletedMultipleDifferences(self, differences, result_values,
                                         commit_as_dict):
        c0 = change.Change((change.Commit('chromium', 'git_hash_0'), ))
        c1 = change.Change((change.Commit('chromium', 'git_hash_1'), ))
        c2 = change.Change((change.Commit('chromium', 'git_hash_2'), ))
        c2_5 = change.Change((change.Commit('chromium', 'git_hash_2_5')))
        c3 = change.Change((change.Commit('chromium', 'git_hash_3'), ))
        change_map = {c0: [50], c1: [0], c2: [40], c2_5: [0], c3: []}
        differences.return_value = [(c0, c1), (c1, c2), (c2_5, c3)]
        result_values.side_effect = lambda c: change_map.get(c, [])
        commit_as_dict.side_effect = (
            {
                'repository': 'chromium',
                'git_hash': 'git_hash_1',
                'url': 'https://example.com/repository/+/git_hash_1',
                'author': '*****@*****.**',
                'subject': 'Subject.',
                'message': 'Subject.\n\nCommit message.',
            },
            {
                'repository': 'chromium',
                'git_hash': 'git_hash_2',
                'url': 'https://example.com/repository/+/git_hash_2',
                'author': '*****@*****.**',
                'subject': 'Subject.',
                'message': 'Subject.\n\nCommit message.',
            },
            {
                'repository': 'chromium',
                'git_hash': 'git_hash_3',
                'url': 'https://example.com/repository/+/git_hash_3',
                'author': '*****@*****.**',
                'subject': 'Subject.',
                'message': 'Subject.\n\nCommit message.',
            },
        )
        self.get_issue.return_value = {'status': 'Untriaged'}
        j = job.Job.New((), (), bug_id=123456, comparison_mode='performance')
        j.Run()
        self.ExecuteDeferredTasks('default')
        self.assertFalse(j.failed)

        # We now only CC folks from the top commit.
        self.add_bug_comment.assert_called_once_with(
            123456,
            mock.ANY,
            status='Assigned',
            owner='*****@*****.**',
            cc_list=['*****@*****.**'],
            labels=[
                'Pinpoint-Multiple-Culprits',
                'Pinpoint-Multiple-MissingValues',
            ],
            merge_issue=None,
            project='chromium')
        message = self.add_bug_comment.call_args[0][1]
        self.assertIn('Found significant differences at 2 commits.', message)
        self.assertIn('1. Subject.', message)
        self.assertIn('transitions from "no values" to "some values"', message)
Пример #12
0
  def testMidpointReturnsNoneWithAdjacentCommitsAndNoDepsRoll(
      self, commit_range, file_contents):
    commit_range.return_value = [{'commit': 'b57345e'}]
    file_contents.return_value = 'deps = {}'

    change_a = change.Change(change.Dep('src', '949b36d'))
    change_b = change.Change(change.Dep('src', 'b57345e'))
    self.assertIsNone(change.Change.Midpoint(change_a, change_b))
Пример #13
0
    def testCompletedMultipleDifferences_NoDeltas(self, differences,
                                                  result_values,
                                                  commit_as_dict):
        """Regression test for http://crbug.com/1078680.

    Picks people to notify even when none of the differences have deltas (they
    are all transitions to/from "No values").
    """
        # Two differences, neither has deltas (50 -> No Values, No Values -> 50).
        c0 = change.Change((change.Commit('chromium', 'git_hash_0'), ))
        c1 = change.Change((change.Commit('chromium', 'git_hash_1'), ))
        c2 = change.Change((change.Commit('chromium', 'git_hash_2'), ))
        change_map = {c0: [50], c1: [], c2: [50]}
        differences.return_value = [(c0, c1), (c1, c2)]
        result_values.side_effect = lambda c: change_map.get(c, [])
        commit_as_dict.side_effect = (
            {
                'repository': 'chromium',
                'git_hash': 'git_hash_1',
                'url': 'https://example.com/repository/+/git_hash_1',
                'author': '*****@*****.**',
                'subject': 'Subject.',
                'message': 'Subject.\n\nCommit message.',
            },
            {
                'repository': 'chromium',
                'git_hash': 'git_hash_2',
                'url': 'https://example.com/repository/+/git_hash_2',
                'author': '*****@*****.**',
                'subject': 'Subject.',
                'message': 'Subject.\n\nCommit message.',
            },
        )

        self.get_issue.return_value = {'status': 'Untriaged'}
        j = job.Job.New((), (), bug_id=123456, comparison_mode='performance')
        j.Run()
        self.ExecuteDeferredTasks('default')
        self.assertFalse(j.failed)

        # Notifies the owner of the first change in the list of differences, seeing
        # as they are all equally small.
        self.add_bug_comment.assert_called_once_with(
            123456,
            mock.ANY,
            status='Assigned',
            owner='*****@*****.**',
            cc_list=['*****@*****.**'],
            labels=[
                'Pinpoint-Multiple-MissingValues',
            ],
            merge_issue=None,
            project='chromium')
        message = self.add_bug_comment.call_args[0][1]
        self.assertIn('Missing Values', message)
        self.assertIn('*****@*****.**', message)
        self.assertIn('*****@*****.**', message)
Пример #14
0
    def testCompletedMultipleDifferences(self, differences, result_values,
                                         commit_as_dict):
        c0 = change.Change((change.Commit('chromium', 'git_hash_0'), ))
        c1 = change.Change((change.Commit('chromium', 'git_hash_1'), ))
        c2 = change.Change((change.Commit('chromium', 'git_hash_2'), ))
        c2_5 = change.Change((change.Commit('chromium', 'git_hash_2_5')))
        c3 = change.Change((change.Commit('chromium', 'git_hash_3'), ))
        change_map = {c0: [50], c1: [0], c2: [40], c2_5: [0], c3: []}
        differences.return_value = [(c0, c1), (c1, c2), (c2_5, c3)]
        result_values.side_effect = lambda c: change_map.get(c, [])
        commit_as_dict.side_effect = (
            {
                'repository': 'chromium',
                'git_hash': 'git_hash_1',
                'url': 'https://example.com/repository/+/git_hash_1',
                'author': '*****@*****.**',
                'subject': 'Subject.',
                'message': 'Subject.\n\nCommit message.',
            },
            {
                'repository': 'chromium',
                'git_hash': 'git_hash_2',
                'url': 'https://example.com/repository/+/git_hash_2',
                'author': '*****@*****.**',
                'subject': 'Subject.',
                'message': 'Subject.\n\nCommit message.',
            },
            {
                'repository': 'chromium',
                'git_hash': 'git_hash_3',
                'url': 'https://example.com/repository/+/git_hash_3',
                'author': '*****@*****.**',
                'subject': 'Subject.',
                'message': 'Subject.\n\nCommit message.',
            },
        )

        self.get_issue.return_value = {'status': 'Untriaged'}

        j = job.Job.New((), (), bug_id=123456, comparison_mode='performance')
        j.Run()

        self.ExecuteDeferredTasks('default')

        self.assertFalse(j.failed)

        # We now only CC folks from the top two commits.
        self.add_bug_comment.assert_called_once_with(
            123456,
            _COMMENT_COMPLETED_THREE_DIFFERENCES,
            status='Assigned',
            owner='*****@*****.**',
            cc_list=['*****@*****.**', '*****@*****.**'],
            merge_issue=None)
Пример #15
0
    def testCompletedMultipleDifferences_BlameAbsoluteLargest(
            self, differences, result_values, commit_as_dict):
        c1 = change.Change((change.Commit('chromium', 'git_hash_1'), ))
        c2 = change.Change((change.Commit('chromium', 'git_hash_2'), ))
        c3 = change.Change((change.Commit('chromium', 'git_hash_3'), ))
        differences.return_value = [(None, c1), (None, c2), (None, c3)]
        result_values.side_effect = [10], [0], [0], [-100], [0], []
        commit_as_dict.side_effect = (
            {
                'repository': 'chromium',
                'git_hash': 'git_hash_1',
                'url': 'https://example.com/repository/+/git_hash_1',
                'author': '*****@*****.**',
                'subject': 'Subject.',
                'message': 'Subject.\n\nCommit message.',
            },
            {
                'repository': 'chromium',
                'git_hash': 'git_hash_2',
                'url': 'https://example.com/repository/+/git_hash_2',
                'author': '*****@*****.**',
                'subject': 'Subject.',
                'message': 'Subject.\n\nCommit message.',
            },
            {
                'repository': 'chromium',
                'git_hash': 'git_hash_3',
                'url': 'https://example.com/repository/+/git_hash_3',
                'author': '*****@*****.**',
                'subject': 'Subject.',
                'message': 'Subject.\n\nCommit message.',
            },
        )

        self.get_issue.return_value = {'status': 'Untriaged'}

        j = job.Job.New((), (), bug_id=123456, comparison_mode='performance')
        j.Run()

        self.ExecuteDeferredTasks('default')

        self.assertFalse(j.failed)

        # We now only CC folks from the top two commits, in absolute descending
        # order.
        self.add_bug_comment.assert_called_once_with(
            123456,
            _COMMENT_COMPLETED_THREE_DIFFERENCES_ABSOLUTE,
            status='Assigned',
            owner='*****@*****.**',
            cc_list=['*****@*****.**', '*****@*****.**'],
            merge_issue=None)
Пример #16
0
    def testCompletedWithAutorollCulpritButNotMostRecent(
            self, differences, result_values, commit_as_dict):
        """Regression test for http://crbug.com/1076756.

    When an autoroll has the biggest delta, assigns to its sheriff even when it
    is not the latest change.
    """
        c0 = change.Change((change.Commit('chromium', 'git_hash_0'), ))
        c1 = change.Change((change.Commit('chromium', 'git_hash_1'), ))
        c2 = change.Change((change.Commit('chromium', 'git_hash_2'), ))
        change_map = {c0: [0], c1: [10], c2: [10]}
        differences.return_value = [(c0, c1), (c1, c2)]
        result_values.side_effect = lambda c: change_map.get(c, [])
        commit_as_dict.side_effect = (
            {
                'repository': 'chromium',
                'git_hash': 'git_hash_1',
                'url': 'https://example.com/repository/+/git_hash_1',
                'author':
                '*****@*****.**',
                'subject': 'Subject.',
                'message':
                'Subject.\n\nCommit message.\n\[email protected]',
            },
            {
                'repository': 'chromium',
                'git_hash': 'git_hash_2',
                'url': 'https://example.com/repository/+/git_hash_2',
                'author': '*****@*****.**',
                'subject': 'Subject.',
                'message': 'Subject.\n\nCommit message.',
            },
        )

        self.get_issue.return_value = {'status': 'Untriaged'}

        j = job.Job.New((), (), bug_id=123456, comparison_mode='performance')
        j.put()
        j.Run()

        self.ExecuteDeferredTasks('default')

        self.assertFalse(j.failed)
        self.add_bug_comment.assert_called_once_with(
            mock.ANY,
            mock.ANY,
            status='Assigned',
            owner='*****@*****.**',
            cc_list=['*****@*****.**'],
            labels=mock.ANY,
            merge_issue=None)
Пример #17
0
  def testMidpointSuccess(self, commit_range):
    commit_range.return_value = [
        {'commit': 'babe852'},
        {'commit': 'b57345e'},
        {'commit': '949b36d'},
        {'commit': '1ef4789'},
    ]

    change_a = change.Change(change.Dep('src', '0e57e2b'),
                             (change.Dep('catapult', 'e0a2efb'),))
    change_b = change.Change(change.Dep('src', 'babe852'),
                             (change.Dep('catapult', 'e0a2efb'),))
    self.assertEqual(change.Change.Midpoint(change_a, change_b),
                     change.Change(change.Dep('src', '949b36d'),
                                   (change.Dep('catapult', 'e0a2efb'),)))
Пример #18
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))})
Пример #19
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)
Пример #20
0
    def testNoIsolatedAvailable(self):
        change = change_module.Change(
            change_module.Dep('chromium/src', 'bad_hash'))
        execution = find_isolated.FindIsolated('Mac Pro Perf').Start(change)

        execution.Poll()
        self.assertExecutionFailure(execution)
    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)
Пример #22
0
 def testCompletedWithCommitAndDocs(
     self, differences, result_values, commit_as_dict):
   c = change.Change((change.Commit('chromium', 'git_hash'),))
   differences.return_value = [(None, c)]
   result_values.side_effect = [1.23456], [0]
   commit_as_dict.return_value = {
       'repository': 'chromium',
       'git_hash': 'git_hash',
       'url': 'https://example.com/repository/+/git_hash',
       'author': '*****@*****.**',
       'subject': 'Subject.',
       'message': 'Subject.\n\nCommit message.',
   }
   self.get_issue.return_value = {'status': 'Untriaged'}
   j = job.Job.New(
       (), (), bug_id=123456, comparison_mode='performance',
       tags={'test_path': 'master/bot/benchmark'})
   diag_dict = generic_set.GenericSet([[u'Benchmark doc link', u'http://docs']])
   diag = histogram.SparseDiagnostic(
       data=diag_dict.AsDict(), start_revision=1, end_revision=sys.maxsize,
       name=reserved_infos.DOCUMENTATION_URLS.name,
       test=utils.TestKey('master/bot/benchmark'))
   diag.put()
   j.Run()
   self.ExecuteDeferredTasks('default')
   self.assertFalse(j.failed)
   self.add_bug_comment.assert_called_once_with(
       123456,
       _COMMENT_COMPLETED_WITH_COMMIT_AND_DOCS,
       status='Assigned',
       owner='*****@*****.**',
       labels=['Pinpoint-Culprit-Found'],
       cc_list=['*****@*****.**'],
       merge_issue=None,
       project='chromium')
Пример #23
0
 def testCompletedMergeIntoExisting(
     self, differences, result_values, commit_as_dict):
   c = change.Change((change.Commit('chromium', 'git_hash'),))
   differences.return_value = [(None, c)]
   result_values.side_effect = [0], [1.23456]
   commit_as_dict.return_value = {
       'repository': 'chromium',
       'git_hash': 'git_hash',
       'author': '*****@*****.**',
       'subject': 'Subject.',
       'url': 'https://example.com/repository/+/git_hash',
       'message': 'Subject.\n\nCommit message.',
   }
   self.get_issue.return_value = {
       'status': 'Untriaged',
       'id': '111222',
       'projectId': 'chromium'
   }
   layered_cache.SetExternal('commit_hash_git_hash', 'chromium:111222')
   j = job.Job.New((), (), bug_id=123456, comparison_mode='performance')
   j.Run()
   self.ExecuteDeferredTasks('default')
   self.assertFalse(j.failed)
   self.add_bug_comment.assert_called_once_with(
       123456,
       _COMMENT_COMPLETED_WITH_COMMIT,
       status='Assigned',
       owner='*****@*****.**',
       cc_list=[],
       labels=['Pinpoint-Culprit-Found'],
       merge_issue='111222',
       project='chromium')
Пример #24
0
  def testFromDictWithJustBaseCommit(self, _):
    c = change.Change.FromDict({
        'base_commit': {'repository': 'src', 'git_hash': 'aaa7336'},
    })

    expected = change.Change(change.Dep('src', 'aaa7336'))
    self.assertEqual(c, expected)
Пример #25
0
  def testChange(self):
    base_commit = change.Dep('src', 'aaa7336')
    dep = change.Dep('catapult', 'e0a2efb')
    patch = change.Patch('https://codereview.chromium.org', 2565263002, 20001)

    # Also test the deps conversion to frozenset.
    c = change.Change(base_commit, [dep], patch)

    self.assertEqual(c, change.Change(base_commit, (dep,), patch))
    string = ('src@aaa7336 catapult@e0a2efb + '
              'https://codereview.chromium.org/2565263002/20001')
    self.assertEqual(str(c), string)
    self.assertEqual(c.base_commit, base_commit)
    self.assertEqual(c.deps, frozenset((dep,)))
    self.assertEqual(c.all_deps, (base_commit, dep))
    self.assertEqual(c.patch, patch)
Пример #26
0
    def testCompletedWithAutoroll(self, differences, commit_as_dict):
        c = change.Change((change.Commit('chromium', 'git_hash'), ))
        differences.return_value = [(None, c, [0], [1.23456])]
        commit_as_dict.return_value = {
            'repository': 'chromium',
            'git_hash': 'git_hash',
            'author': '*****@*****.**',
            'subject': 'Subject.',
            'reviewers': ['*****@*****.**'],
            'url': 'https://example.com/repository/+/git_hash',
            'tbr': '*****@*****.**',
        }

        self.get_issue.return_value = {'status': 'Untriaged'}

        j = job.Job.New((), (), bug_id=123456, comparison_mode='performance')
        j.put()
        j.Run()

        self.add_bug_comment.assert_called_once_with(
            123456,
            _COMMENT_COMPLETED_WITH_AUTOROLL_COMMIT,
            status='Assigned',
            owner='*****@*****.**',
            cc_list=['*****@*****.**'])
Пример #27
0
 def testCompletedDoesNotReopen(self, differences, result_values,
                                patch_as_dict):
     commits = (change.Commit('chromium', 'git_hash'), )
     patch = change.GerritPatch('https://codereview.com', 672011, '2f0d5c7')
     c = change.Change(commits, patch)
     differences.return_value = [(None, c)]
     result_values.side_effect = [40], [20]
     patch_as_dict.return_value = {
         'url': 'https://codereview.com/c/672011/2f0d5c7',
         'author': '*****@*****.**',
         'subject': 'Subject.',
         'message': 'Subject.\n\nCommit message.',
     }
     self.get_issue.return_value = {'status': 'Fixed'}
     j = job.Job.New((), (), bug_id=123456, comparison_mode='performance')
     j.Run()
     self.ExecuteDeferredTasks('default')
     self.assertFalse(j.failed)
     self.add_bug_comment.assert_called_once_with(
         123456,
         mock.ANY,
         owner=None,
         status=None,
         cc_list=['*****@*****.**'],
         labels=mock.ANY,
         merge_issue=None,
         project='chromium')
     message = self.add_bug_comment.call_args[0][1]
     self.assertIn('10 revisions compared', message)
     labels = self.add_bug_comment.call_args[1]['labels']
     self.assertIn('Pinpoint-Job-Completed', labels)
     self.assertNotIn('-Pinpoint-Job-Completed', labels)
     self.assertIn('Pinpoint-Culprit-Found', labels)
     self.assertNotIn('-Pinpoint-Culprit-Found', labels)
Пример #28
0
    def testCompletedWithCommit(self, differences, result_values,
                                commit_as_dict):
        c = change.Change((change.Commit('chromium', 'git_hash'), ))
        differences.return_value = [(None, c)]
        result_values.side_effect = [0], [1.23456]
        commit_as_dict.return_value = {
            'repository': 'chromium',
            'git_hash': 'git_hash',
            'url': 'https://example.com/repository/+/git_hash',
            'author': '*****@*****.**',
            'subject': 'Subject.',
            'message': 'Subject.\n\nCommit message.',
        }

        self.get_issue.return_value = {'status': 'Untriaged'}

        j = job.Job.New((), (), bug_id=123456, comparison_mode='performance')
        j.Run()

        self.ExecuteDeferredTasks('default')

        self.assertFalse(j.failed)
        self.add_bug_comment.assert_called_once_with(
            123456,
            _COMMENT_COMPLETED_WITH_COMMIT,
            status='Assigned',
            owner='*****@*****.**',
            cc_list=['*****@*****.**'],
            merge_issue=None)
Пример #29
0
  def testCompletedWithAutoroll(
      self, differences, result_values, commit_as_dict):
    c = change.Change((change.Commit('chromium', 'git_hash'),))
    differences.return_value = [(None, c)]
    result_values.side_effect = [20], [30]
    commit_as_dict.return_value = {
        'repository': 'chromium',
        'git_hash': 'git_hash',
        'url': 'https://example.com/repository/+/git_hash',
        'author': '*****@*****.**',
        'subject': 'Subject.',
        'message': 'Subject.\n\nCommit message.\n\[email protected]',
    }

    self.get_issue.return_value = {'status': 'Untriaged'}
    j = job.Job.New((), (), bug_id=123456, comparison_mode='performance')
    j.put()
    j.Run()
    self.ExecuteDeferredTasks('default')
    self.assertFalse(j.failed)
    self.add_bug_comment.assert_called_once_with(
        123456,
        _COMMENT_COMPLETED_WITH_AUTOROLL_COMMIT,
        status='Assigned',
        owner='*****@*****.**',
        cc_list=['*****@*****.**'],
        labels=['Pinpoint-Culprit-Found'],
        merge_issue=None,
        project='chromium')
Пример #30
0
  def testIsolateLookupSuccess(self):
    change = change_module.Change(change_module.Dep('chromium/src', 'f9f2b720'))
    execution = find_isolated.FindIsolated('Mac Pro Perf').Start(change)
    execution.Poll()

    self.assertExecutionSuccess(execution)
    self.assertEqual(execution.result_arguments, {'isolated_hash': '7c7e90be'})