Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1189)

Unified Diff: appengine/findit/waterfall/flake/test/recursive_flake_pipeline_test.py

Issue 2438673004: [Findit] Post analysis results of flakes to bug filed by chromium-try-flakes. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/findit/waterfall/flake/test/recursive_flake_pipeline_test.py
diff --git a/appengine/findit/waterfall/flake/test/recursive_flake_pipeline_test.py b/appengine/findit/waterfall/flake/test/recursive_flake_pipeline_test.py
index ccb7520e7bf80f1f33785f6515bdaaac6eac06d5..d5e00109e07f778286220f480ccac5040dd1b3d9 100644
--- a/appengine/findit/waterfall/flake/test/recursive_flake_pipeline_test.py
+++ b/appengine/findit/waterfall/flake/test/recursive_flake_pipeline_test.py
@@ -162,7 +162,9 @@ class RecursiveFlakePipelineTest(wf_testcase.WaterfallTestCase):
@mock.patch.object(
recursive_flake_pipeline, '_GetETAToStartAnalysis', return_value=None)
- def testNextBuildPipelineForNewRecursionFirstFlake(self, _mocked_eta_func):
+ @mock.patch.object(
+ recursive_flake_pipeline, '_UpdateBugWithResult', return_value=None)
+ def testNextBuildPipelineForNewRecursionFirstFlake(self, *_):
master_name = 'm'
builder_name = 'b'
master_build_number = 100
@@ -208,7 +210,9 @@ class RecursiveFlakePipelineTest(wf_testcase.WaterfallTestCase):
@mock.patch.object(
recursive_flake_pipeline, '_GetETAToStartAnalysis', return_value=None)
- def testNextBuildPipelineForNewRecursionFirstStable(self, _mocked_eta_func):
+ @mock.patch.object(
+ recursive_flake_pipeline, '_UpdateBugWithResult', return_value=None)
+ def testNextBuildPipelineForNewRecursionFirstStable(self, *_):
master_name = 'm'
builder_name = 'b'
master_build_number = 100
@@ -252,7 +256,9 @@ class RecursiveFlakePipelineTest(wf_testcase.WaterfallTestCase):
@mock.patch.object(
recursive_flake_pipeline, '_GetETAToStartAnalysis', return_value=None)
- def testNextBuildPipelineForNewRecursionFlakeInARow(self, _mocked_eta_func):
+ @mock.patch.object(
+ recursive_flake_pipeline, '_UpdateBugWithResult', return_value=None)
+ def testNextBuildPipelineForNewRecursionFlakeInARow(self, *_):
master_name = 'm'
builder_name = 'b'
master_build_number = 100
@@ -297,7 +303,9 @@ class RecursiveFlakePipelineTest(wf_testcase.WaterfallTestCase):
@mock.patch.object(
recursive_flake_pipeline, '_GetETAToStartAnalysis', return_value=None)
- def testNextBuildPipelineForNewRecursionStableInARow(self, _mocked_eta_func):
+ @mock.patch.object(
+ recursive_flake_pipeline, '_UpdateBugWithResult', return_value=None)
+ def testNextBuildPipelineForNewRecursionStableInARow(self, *_):
master_name = 'm'
builder_name = 'b'
master_build_number = 100
@@ -342,8 +350,9 @@ class RecursiveFlakePipelineTest(wf_testcase.WaterfallTestCase):
@mock.patch.object(
recursive_flake_pipeline, '_GetETAToStartAnalysis', return_value=None)
- def testNextBuildPipelineForNewRecursionLessThanLastBuildNumber(
- self, _mocked_eta_func):
+ @mock.patch.object(
+ recursive_flake_pipeline, '_UpdateBugWithResult', return_value=None)
+ def testNextBuildPipelineForNewRecursionLessThanLastBuildNumber(self, *_):
master_name = 'm'
builder_name = 'b'
master_build_number = 100
@@ -393,7 +402,9 @@ class RecursiveFlakePipelineTest(wf_testcase.WaterfallTestCase):
@mock.patch.object(
recursive_flake_pipeline, '_GetETAToStartAnalysis', return_value=None)
- def testNextBuildPipelineForFailedSwarmingTask(self, _mocked_eta_func):
+ @mock.patch.object(
+ recursive_flake_pipeline, '_UpdateBugWithResult', return_value=None)
+ def testNextBuildPipelineForFailedSwarmingTask(self, *_):
master_name = 'm'
builder_name = 'b'
master_build_number = 100
@@ -443,8 +454,9 @@ class RecursiveFlakePipelineTest(wf_testcase.WaterfallTestCase):
@mock.patch.object(
recursive_flake_pipeline, '_GetETAToStartAnalysis', return_value=None)
- def testNextBuildPipelineForNewRecursionStabledFlakedOut(
- self, _mocked_eta_func):
+ @mock.patch.object(
+ recursive_flake_pipeline, '_UpdateBugWithResult', return_value=None)
+ def testNextBuildPipelineForNewRecursionStabledFlakedOut(self, *_):
master_name = 'm'
builder_name = 'b'
master_build_number = 100
@@ -697,7 +709,9 @@ class RecursiveFlakePipelineTest(wf_testcase.WaterfallTestCase):
@mock.patch.object(
recursive_flake_pipeline, '_GetETAToStartAnalysis', return_value=None)
- def testNextBuildPipelineStabledOutFlakedOutFirstTime(self, _mocked_eta_func):
+ @mock.patch.object(
+ recursive_flake_pipeline, '_UpdateBugWithResult', return_value=None)
+ def testNextBuildPipelineStabledOutFlakedOutFirstTime(self, *_):
master_name = 'm'
builder_name = 'b'
master_build_number = 100
@@ -873,3 +887,45 @@ class RecursiveFlakePipelineTest(wf_testcase.WaterfallTestCase):
analysis = MasterFlakeAnalysis.GetVersion(
master_name, builder_name, master_build_number, step_name, test_name)
self.assertEqual(analysis_status.COMPLETED, analysis.status)
+
+ @mock.patch(
+ 'waterfall.flake.recursive_flake_pipeline.PostCommentToBugPipeline')
+ def testUpdateBugWithResultWithoutAttachedBug(self, _):
+ master_name = 'm'
+ builder_name = 'b'
+ master_build_number = 100
+ step_name = 's'
+ test_name = 't'
+ analysis = MasterFlakeAnalysis.Create(
+ master_name, builder_name, master_build_number, step_name, test_name)
+ self.assertFalse(
+ recursive_flake_pipeline._UpdateBugWithResult(analysis, None))
+
+ @mock.patch(
+ 'waterfall.flake.recursive_flake_pipeline.PostCommentToBugPipeline')
+ def testUpdateBugWithResultWithAttachedBug(self, mocked_pipeline):
+ mocked_target = mock.Mock()
+ mocked_pipeline.attach_mock(mocked_target, 'target')
+ master_name = 'm'
+ builder_name = 'b'
+ master_build_number = 100
+ step_name = 's'
+ test_name = 't'
+ analysis = MasterFlakeAnalysis.Create(
+ master_name, builder_name, master_build_number, step_name, test_name)
+ analysis.bug_id = 123
+ analysis.original_master_name = 'om'
+ analysis.original_builder_name = 'ob'
+ analysis.original_step_name = 'os'
+ self.assertTrue(
+ recursive_flake_pipeline._UpdateBugWithResult(analysis, 'queue'))
+ calls = mocked_pipeline.mock_calls
+ self.assertEqual(2, len(calls))
+
+ _, args, __ = calls[0]
+ bug_id, comment, labels = args
+ self.assertEqual(123, bug_id)
+ self.assertEqual(['AnalyzedByFindit'], labels)
+ self.assertTrue('om / ob / os' in comment)
+
+ self.assertEqual(mock.call().start(queue_name='queue'), calls[1])

Powered by Google App Engine
This is Rietveld 408576698