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

Unified Diff: appengine/findit/waterfall/test/monitor_try_job_pipeline_test.py

Issue 1591003002: [Findit] Modify tryjob pipelines to trigger try jobs for test failure. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: If different tests within the same step fail in different revisions, all revisions should be culpri… Created 4 years, 11 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/test/monitor_try_job_pipeline_test.py
diff --git a/appengine/findit/waterfall/test/monitor_try_job_pipeline_test.py b/appengine/findit/waterfall/test/monitor_try_job_pipeline_test.py
index ef0fc831659e9e4931eefaf9d3c806b61bcbc242..a80b035e1efd018097104cdefb03fe8b7f1c3f1c 100644
--- a/appengine/findit/waterfall/test/monitor_try_job_pipeline_test.py
+++ b/appengine/findit/waterfall/test/monitor_try_job_pipeline_test.py
@@ -28,17 +28,29 @@ class MonitorTryJobPipelineTest(testing.AppengineTestCase):
'reason': 'BUILD_NOT_FOUND',
'message': 'message',
}
+ },
+ '3': {
+ 'build': {
+ 'id': '3',
+ 'url': 'url',
+ 'status': 'COMPLETED',
+ 'result_details_json': (
+ '{"properties": {"result": {"rev1": {"a_test": {"status":'
+ ' "passed", "valid": true}}, "rev2": {"a_test": '
+ '{"status": "failed", "valid": true, "failures": ["test1"'
+ ', "test2"]}}}}}')
+ }
}
}
- compile_results = []
+ try_job_results = []
build_error = data.get(build_id)
if build_error.get('error'): # pragma: no cover
- compile_results.append((
+ try_job_results.append((
buildbucket_client.BuildbucketError(build_error['error']), None))
else:
- compile_results.append((
+ try_job_results.append((
None, buildbucket_client.BuildbucketBuild(build_error['build'])))
- return compile_results
+ return try_job_results
self.mock(buildbucket_client, 'GetTryJobs', Mocked_GetTryJobs)
def testGetTryJobsForCompileSuccess(self):
@@ -61,7 +73,7 @@ class MonitorTryJobPipelineTest(testing.AppengineTestCase):
pipeline = MonitorTryJobPipeline()
compile_result = pipeline.run(
- master_name, builder_name, build_number, try_job_id)
+ master_name, builder_name, build_number, 'compile', try_job_id)
expected_compile_result = {
'result': [
@@ -76,3 +88,51 @@ class MonitorTryJobPipelineTest(testing.AppengineTestCase):
try_job = WfTryJob.Get(master_name, builder_name, build_number)
self.assertEqual(expected_compile_result, try_job.compile_results[-1])
self.assertEqual(wf_analysis_status.ANALYZING, try_job.status)
+
+
+ def testGetTryJobsForTestSuccess(self):
+ master_name = 'm'
+ builder_name = 'b'
+ build_number = 1
+ try_job_id = '3'
+
+ try_job = WfTryJob.Create(master_name, builder_name, build_number)
+ try_job.test_results = [
+ {
+ 'result': None,
+ 'url': 'url',
+ 'try_job_id': '3',
+ }
+ ]
+ try_job.status = wf_analysis_status.ANALYZING
+ try_job.put()
+ self._Mock_GetTryJobs(try_job_id)
+
+ pipeline = MonitorTryJobPipeline()
+ test_result = pipeline.run(
+ master_name, builder_name, build_number, 'test', try_job_id)
+
+ expected_test_result = {
+ 'result': {
+ 'rev1': {
+ 'a_test': {
+ 'status': 'passed',
+ 'valid': True
+ }
+ },
+ 'rev2': {
+ 'a_test': {
+ 'status': 'failed',
+ 'valid': True,
+ 'failures': ['test1', 'test2']
+ }
+ }
+ },
+ 'url': 'url',
+ 'try_job_id': '3',
+ }
+ self.assertEqual(expected_test_result, test_result)
+
+ try_job = WfTryJob.Get(master_name, builder_name, build_number)
+ self.assertEqual(expected_test_result, try_job.test_results[-1])
+ self.assertEqual(wf_analysis_status.ANALYZING, try_job.status)

Powered by Google App Engine
This is Rietveld 408576698