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

Unified Diff: appengine/findit/waterfall/test/schedule_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: Simplify the format for final try-job result for test failures. 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/schedule_try_job_pipeline_test.py
diff --git a/appengine/findit/waterfall/test/schedule_try_job_pipeline_test.py b/appengine/findit/waterfall/test/schedule_try_job_pipeline_test.py
index 1a11afcb14961c8ed5510fd47b5cb10180a89312..49146ba4556d08024a8c3f2192cec8e6620000c6 100644
--- a/appengine/findit/waterfall/test/schedule_try_job_pipeline_test.py
+++ b/appengine/findit/waterfall/test/schedule_try_job_pipeline_test.py
@@ -8,6 +8,7 @@ from common import buildbucket_client
from model.wf_try_job import WfTryJob
from waterfall import waterfall_config
from waterfall.schedule_try_job_pipeline import ScheduleTryJobPipeline
+from waterfall.try_job_enums import TryJobType
class ScheduleTryjobPipelineTest(testing.AppengineTestCase):
@@ -34,11 +35,10 @@ class ScheduleTryjobPipelineTest(testing.AppengineTestCase):
def testGetBuildPropertiesWithCompileTargets(self):
master_name = 'm'
builder_name = 'b'
- recipe = 'a/b/recipe'
compile_targets = ['a.exe']
expected_properties = {
- 'recipe': recipe,
+ 'recipe': 'findit/chromium/compile',
'good_revision': 1,
'bad_revision': 2,
'target_mastername': master_name,
@@ -47,7 +47,28 @@ class ScheduleTryjobPipelineTest(testing.AppengineTestCase):
}
try_job_pipeline = ScheduleTryJobPipeline()
properties = try_job_pipeline._getBuildProperties(
- recipe, master_name, builder_name, 1, 2, compile_targets)
+ master_name, builder_name, 1, 2, TryJobType.COMPILE,
+ compile_targets, None)
+
+ self.assertEqual(properties, expected_properties)
+
+ def testGetBuildPropertiesForTestFailure(self):
+ master_name = 'm'
+ builder_name = 'b'
+ targeted_tests = {'a':[]}
+
+ expected_properties = {
+ 'recipe': 'findit/chromium/test',
+ 'good_revision': 1,
+ 'bad_revision': 2,
+ 'target_mastername': master_name,
+ 'target_testername': 'b',
+ 'tests': targeted_tests
+ }
+ try_job_pipeline = ScheduleTryJobPipeline()
+ properties = try_job_pipeline._getBuildProperties(
+ master_name, builder_name, 1, 2, TryJobType.TEST,
+ None, targeted_tests)
self.assertEqual(properties, expected_properties)
@@ -75,8 +96,40 @@ class ScheduleTryjobPipelineTest(testing.AppengineTestCase):
try_job_pipeline = ScheduleTryJobPipeline()
try_job_id = try_job_pipeline.run(
master_name, builder_name, build_number, good_revision, bad_revision,
- [])
+ TryJobType.COMPILE, None, None)
try_job = WfTryJob.Get(master_name, builder_name, build_number)
self.assertEqual('1', try_job_id)
self.assertEqual('1', try_job.compile_results[-1]['try_job_id'])
+
+
+ def testSuccessfullyScheduleNewTryJobForTest(self):
+ master_name = 'm'
+ builder_name = 'b'
+ build_number = 223
+ good_revision = 'rev1'
+ bad_revision = 'rev2'
+ targeted_tests = ['browser_test']
stgao 2016/01/29 18:55:02 But this parameter doesn't look right to me. The r
chanli 2016/01/30 02:22:37 Done.
+
+ responses = [
+ {
+ 'build': {
+ 'id': '1',
+ 'url': 'url',
+ 'status': 'SCHEDULED',
+ }
+ }
+ ]
+ self._Mock_GetTrybotForWaterfallBuilder(master_name, builder_name)
+ self._Mock_TriggerTryJobs(responses)
+
+ WfTryJob.Create(master_name, builder_name, build_number).put()
+
+ try_job_pipeline = ScheduleTryJobPipeline()
+ try_job_id = try_job_pipeline.run(
+ master_name, builder_name, build_number, good_revision, bad_revision,
+ TryJobType.TEST, None, targeted_tests)
+
+ try_job = WfTryJob.Get(master_name, builder_name, build_number)
+ self.assertEqual('1', try_job_id)
+ self.assertEqual('1', try_job.test_results[-1]['try_job_id'])

Powered by Google App Engine
This is Rietveld 408576698