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

Side by Side Diff: appengine/findit/waterfall/flake/test/schedule_flake_try_job_pipeline_test.py

Issue 2605153002: [Findit] Adding schedule_flake_try_job_pipeline.py to trigger flake try jobs (Closed)
Patch Set: Fixing unintentional change Created 3 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 unified diff | Download patch
« no previous file with comments | « appengine/findit/waterfall/flake/schedule_flake_try_job_pipeline.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import mock
6
7 from common.waterfall import buildbucket_client
8 from model.flake.flake_try_job import FlakeTryJob
9 from model.flake.flake_try_job_data import FlakeTryJobData
10 from waterfall import schedule_try_job_pipeline
11 from waterfall.flake.schedule_flake_try_job_pipeline import (
12 ScheduleFlakeTryJobPipeline)
13 from waterfall.test import wf_testcase
14
15
16 class ScheduleFlakeTryJobPipelineTest(wf_testcase.WaterfallTestCase):
17
18 def testGetBuildProperties(self):
19 self.UpdateUnitTestConfigSettings(
20 config_property='check_flake_settings',
21 override_data={'iterations_to_rerun': 100})
22 master_name = 'm'
23 builder_name = 'b'
24 step_name = 's'
25 test_name = 't'
26 git_hash = 'a1b2c3d4'
27
28 expected_properties = {
29 'recipe': 'findit/chromium/flake',
30 'target_mastername': master_name,
31 'target_testername': builder_name,
32 'test_revision': git_hash,
33 'test_repeat_count': 100,
34 'tests': {
35 step_name: [test_name]
36 }
37 }
38
39 try_job_pipeline = ScheduleFlakeTryJobPipeline()
40 properties = try_job_pipeline._GetBuildProperties(
41 master_name, builder_name, step_name, test_name, git_hash)
42
43 self.assertEqual(properties, expected_properties)
44
45 def testCreateTryJobData(self):
46 master_name = 'm'
47 builder_name = 'b'
48 step_name = 's'
49 test_name = 't'
50 git_hash = 'a1b2c3d4'
51 build_id = 'build_id'
52
53 try_job = FlakeTryJob.Create(
54 master_name, builder_name, step_name, test_name, git_hash)
55 ScheduleFlakeTryJobPipeline()._CreateTryJobData(build_id, try_job.key)
56
57 try_job_data = FlakeTryJobData.Get(build_id)
58
59 self.assertEqual(try_job_data.try_job_key, try_job.key)
60
61 @mock.patch.object(schedule_try_job_pipeline, 'buildbucket_client')
62 def testScheduleFlakeTryJob(self, mock_module):
63 master_name = 'm'
64 builder_name = 'b'
65 step_name = 's'
66 test_name = 't'
67 git_hash = 'a1b2c3d4'
68 build_id = '1'
69 url = 'url'
70
71 response = {
72 'build': {
73 'id': build_id,
74 'url': url,
75 'status': 'SCHEDULED',
76 }
77 }
78 results = [(None, buildbucket_client.BuildbucketBuild(response['build']))]
79 mock_module.TriggerTryJobs.return_value = results
80
81 FlakeTryJob.Create(
82 master_name, builder_name, step_name, test_name, git_hash).put()
83
84 try_job_pipeline = ScheduleFlakeTryJobPipeline()
85 try_job_id = try_job_pipeline.run(
86 master_name, builder_name, step_name, test_name, git_hash)
87
88 try_job = FlakeTryJob.Get(
89 master_name, builder_name, step_name, test_name, git_hash)
90 try_job_data = FlakeTryJobData.Get(build_id)
91
92 self.assertEqual(build_id, try_job_id)
93 self.assertEqual(build_id, try_job.flake_results[-1]['try_job_id'])
94 self.assertTrue(build_id in try_job.try_job_ids)
95 self.assertEqual(try_job_data.try_job_key, try_job.key)
OLDNEW
« no previous file with comments | « appengine/findit/waterfall/flake/schedule_flake_try_job_pipeline.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698