def testMapAnomaliesToMergeIntoBug(self): # Add anomalies. test_keys = list( map(utils.TestKey, [ 'ChromiumGPU/linux-release/scrolling-benchmark/first_paint', 'ChromiumGPU/linux-release/scrolling-benchmark/mean_frame_time' ])) anomaly.Anomaly(start_revision=9990, end_revision=9997, test=test_keys[0], median_before_anomaly=100, median_after_anomaly=200, bug_id=12345).put() anomaly.Anomaly(start_revision=9990, end_revision=9996, test=test_keys[0], median_before_anomaly=100, median_after_anomaly=200, bug_id=54321).put() # Map anomalies to base(dest_bug_id) bug. update_bug_with_results._MapAnomaliesToMergeIntoBug( dest_issue=update_bug_with_results.IssueInfo('chromium', 12345), source_issue=update_bug_with_results.IssueInfo('chromium', 54321)) anomalies = anomaly.Anomaly.query( anomaly.Anomaly.bug_id == int(54321), anomaly.Anomaly.project_id == 'chromium').fetch() self.assertEqual(0, len(anomalies))
def testMapAnomaliesToMergeIntoBug(self): # Add anomalies. test_keys = map( utils.TestKey, [ "ChromiumGPU/linux-release/scrolling-benchmark/first_paint", "ChromiumGPU/linux-release/scrolling-benchmark/mean_frame_time", ], ) anomaly.Anomaly( start_revision=9990, end_revision=9997, test=test_keys[0], median_before_anomaly=100, median_after_anomaly=200, sheriff=None, bug_id=12345, ).put() anomaly.Anomaly( start_revision=9990, end_revision=9996, test=test_keys[0], median_before_anomaly=100, median_after_anomaly=200, sheriff=None, bug_id=54321, ).put() # Map anomalies to base(dest_bug_id) bug. update_bug_with_results._MapAnomaliesToMergeIntoBug(dest_bug_id=12345, source_bug_id=54321) anomalies = anomaly.Anomaly.query(anomaly.Anomaly.bug_id == int(54321)).fetch() self.assertEqual(0, len(anomalies))
def testAnomalyMappingForMergeIssue(self): # Add anomalies. test_keys = map(utils.TestKey, [ 'ChromiumGPU/linux-release/scrolling-benchmark/first_paint', 'ChromiumGPU/linux-release/scrolling-benchmark/mean_frame_time' ]) anomaly.Anomaly(start_revision=9990, end_revision=9997, test=test_keys[0], median_before_anomaly=100, median_after_anomaly=200, sheriff=None, bug_id=12345).put() anomaly.Anomaly(start_revision=9990, end_revision=9996, test=test_keys[0], median_before_anomaly=100, median_after_anomaly=200, sheriff=None, bug_id=54321).put() # Map anomalies to base(dest_bug_id) bug. update_bug_with_results._MapAnomaliesToMergeIntoBug( dest_bug_id=12345, source_bug_id=54321) anomalies = anomaly.Anomaly.query( anomaly.Anomaly.bug_id == int(54321)).fetch() self.assertEqual(0, len(anomalies))
def testGet_MergesBugIntoExistingBug(self, mock_update_bug): # When there exists a bug with the same revision (commit hash), # mark bug as duplicate and merge current issue into that. try_job.TryJob(bug_id=12345, rietveld_issue_id=200037, rietveld_patchset_id=1, status='started', bot='win_perf').put() try_job.TryJob(bug_id=54321, rietveld_issue_id=200037, rietveld_patchset_id=1, status='started', bot='win_perf').put() # Create bug. bug_data.Bug(id=12345).put() bug_data.Bug(id=54321).put() self.testapp.get('/update_bug_with_results') # Owners of CLs are not cc'ed for duplicate bugs and the issue should be # marked as duplicate. mock_update_bug.assert_called_with(mock.ANY, mock.ANY, cc_list=[], merge_issue='12345', labels=None, owner=None) pending_jobs = try_job.TryJob.query().fetch() self.assertEqual(0, len(pending_jobs)) # Add anomalies. test_keys = map(utils.TestKey, [ 'ChromiumGPU/linux-release/scrolling-benchmark/first_paint', 'ChromiumGPU/linux-release/scrolling-benchmark/mean_frame_time' ]) anomaly.Anomaly(start_revision=9990, end_revision=9997, test=test_keys[0], median_before_anomaly=100, median_after_anomaly=200, sheriff=None, bug_id=12345).put() anomaly.Anomaly(start_revision=9990, end_revision=9996, test=test_keys[0], median_before_anomaly=100, median_after_anomaly=200, sheriff=None, bug_id=54321).put() # Map anomalies to base(dest_bug_id) bug. update_bug_with_results._MapAnomaliesToMergeIntoBug( dest_bug_id=12345, source_bug_id=54321) anomalies = anomaly.Anomaly.query( anomaly.Anomaly.bug_id == int(54321)).fetch() self.assertEqual(0, len(anomalies))
def testGet_MergesBugIntoExistingBug(self, mock_update_bug): # When there exists a bug with the same revision (commit hash), # mark bug as duplicate and merge current issue into that. try_job.TryJob( bug_id=12345, rietveld_issue_id=200037, rietveld_patchset_id=1, status="started", bot="win_perf" ).put() try_job.TryJob( bug_id=54321, rietveld_issue_id=200037, rietveld_patchset_id=1, status="started", bot="win_perf" ).put() # Create bug. bug_data.Bug(id=12345).put() bug_data.Bug(id=54321).put() self.testapp.get("/update_bug_with_results") # Owners of CLs are not cc'ed for duplicate bugs and the issue should be # marked as duplicate. mock_update_bug.assert_called_with(mock.ANY, mock.ANY, cc_list=[], merge_issue="12345", labels=None, owner=None) pending_jobs = try_job.TryJob.query().fetch() self.assertEqual(0, len(pending_jobs)) # Add anomalies. test_keys = map( utils.TestKey, [ "ChromiumGPU/linux-release/scrolling-benchmark/first_paint", "ChromiumGPU/linux-release/scrolling-benchmark/mean_frame_time", ], ) anomaly.Anomaly( start_revision=9990, end_revision=9997, test=test_keys[0], median_before_anomaly=100, median_after_anomaly=200, sheriff=None, bug_id=12345, ).put() anomaly.Anomaly( start_revision=9990, end_revision=9996, test=test_keys[0], median_before_anomaly=100, median_after_anomaly=200, sheriff=None, bug_id=54321, ).put() # Map anomalies to base(dest_bug_id) bug. update_bug_with_results._MapAnomaliesToMergeIntoBug(dest_bug_id=12345, source_bug_id=54321) anomalies = anomaly.Anomaly.query(anomaly.Anomaly.bug_id == int(54321)).fetch() self.assertEqual(0, len(anomalies))