blob: 50d42e4ff50900cff43f7642939ae24dc574a2e2 [file] [log] [blame]
Don Garrettbe3608b2018-06-05 17:10:09 -07001# Copyright 2018 The Chromium OS 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"""Test gen_luci_scheduler."""
Don Garrettbe3608b2018-06-05 17:10:09 -07006
Don Garrett8dace272018-07-19 14:07:42 -07007from chromite.config import chromeos_config
Don Garrettbe3608b2018-06-05 17:10:09 -07008from chromite.lib import config_lib
9from chromite.lib import config_lib_unittest
Mike Frysinger807d8282022-04-28 22:45:17 -040010from chromite.lib import cros_test_lib
Don Garrettbe3608b2018-06-05 17:10:09 -070011from chromite.scripts import gen_luci_scheduler
12
Mike Frysinger74a6cc82020-02-14 14:16:22 -050013
Don Garrettbe3608b2018-06-05 17:10:09 -070014# It's reasonable for unittests to look at internals.
15# pylint: disable=protected-access
16
17
18class GenLuciSchedulerTest(cros_test_lib.MockTestCase):
Alex Klein1699fab2022-09-08 08:46:06 -060019 """Tests for cbuildbot_launch script."""
Don Garrettbe3608b2018-06-05 17:10:09 -070020
Alex Klein1699fab2022-09-08 08:46:06 -060021 def testSanityAgainstProd(self):
22 """Test we can generate a luci scheduler config with live data."""
23 # If it runs without crashing, we pass.
24 gen_luci_scheduler.genLuciSchedulerConfig(
25 config_lib.GetConfig(), chromeos_config.BranchScheduleConfig()
26 )
Don Garrettbe3608b2018-06-05 17:10:09 -070027
Alex Klein1699fab2022-09-08 08:46:06 -060028 def testGenSchedulerJob(self):
29 """Test the job creation helper."""
30 build_config = config_lib_unittest.MockBuildConfig().apply(
31 schedule="funky schedule"
32 )
33
34 expected = """
Don Garrettbe3608b2018-06-05 17:10:09 -070035job {
Mike Nichols9e47e842020-08-11 15:23:56 -060036 id: "amd64-generic-release"
Vadim Shtayura6398e002021-01-11 12:02:11 -080037 realm: "cbb-jobs"
Don Garrettbe3608b2018-06-05 17:10:09 -070038 acl_sets: "default"
39 schedule: "funky schedule"
40 buildbucket: {
41 server: "cr-buildbucket.appspot.com"
Vadim Shtayura959cb0f2022-02-03 12:45:58 -080042 bucket: "general"
Mike Nichols9e47e842020-08-11 15:23:56 -060043 builder: "LegacyRelease"
Mike Frysinger62a02452021-03-16 03:48:34 -040044 tags: "cbb_branch:main"
Mike Nichols9e47e842020-08-11 15:23:56 -060045 tags: "cbb_config:amd64-generic-release"
Don Garrett73148e52018-08-17 16:54:46 -070046 tags: "cbb_display_label:MockLabel"
Mike Frysinger62a02452021-03-16 03:48:34 -040047 properties: "cbb_branch:main"
Mike Nichols9e47e842020-08-11 15:23:56 -060048 properties: "cbb_config:amd64-generic-release"
Don Garrett73148e52018-08-17 16:54:46 -070049 properties: "cbb_display_label:MockLabel"
Don Garrettbe3608b2018-06-05 17:10:09 -070050 properties: "cbb_extra_args:[\\"--buildbot\\"]"
51 }
52}
Mike Frysinger80de5012019-08-01 14:10:53 -040053"""
Don Garrettbe3608b2018-06-05 17:10:09 -070054
Alex Klein1699fab2022-09-08 08:46:06 -060055 result = gen_luci_scheduler.genSchedulerJob(build_config)
56 self.assertEqual(result, expected)
Don Garrettbe3608b2018-06-05 17:10:09 -070057
Alex Klein1699fab2022-09-08 08:46:06 -060058 def testGenSchedulerTriggerSimple(self):
59 """Test the trigger creation helper."""
60 trigger_name = "simple"
61 repo = "url://repo"
62 refs = ["refs/path"]
63 path_regexps = ["path/regexps"]
64 builds = ["test_build"]
Don Garrettbe3608b2018-06-05 17:10:09 -070065
Alex Klein1699fab2022-09-08 08:46:06 -060066 expected = """
Don Garrettbe3608b2018-06-05 17:10:09 -070067trigger {
68 id: "simple"
Vadim Shtayura6398e002021-01-11 12:02:11 -080069 realm: "cbb-jobs"
Don Garrettbe3608b2018-06-05 17:10:09 -070070 acl_sets: "default"
71 schedule: "with 5m interval"
72 gitiles: {
73 repo: "url://repo"
74 refs: "refs/path"
David Burgercba0d272020-06-24 16:21:26 -060075 path_regexps: "path/regexps"
Don Garrettbe3608b2018-06-05 17:10:09 -070076 }
77 triggers: "test_build"
78}
Mike Frysinger80de5012019-08-01 14:10:53 -040079"""
Don Garrettbe3608b2018-06-05 17:10:09 -070080
Alex Klein1699fab2022-09-08 08:46:06 -060081 result = gen_luci_scheduler.genSchedulerTrigger(
82 trigger_name, repo, refs, path_regexps, builds
83 )
Don Garrettbe3608b2018-06-05 17:10:09 -070084
Alex Klein1699fab2022-09-08 08:46:06 -060085 self.assertEqual(result, expected)
Don Garrettbe3608b2018-06-05 17:10:09 -070086
Alex Klein1699fab2022-09-08 08:46:06 -060087 def testGenSchedulerTriggerComplex(self):
88 """Test the trigger creation helper."""
89 trigger_name = "complex"
90 repo = "url://repo"
91 refs = ["refs/path", "refs/other_path"]
92 builds = ["test_build_a", "test_build_b"]
Don Garrettbe3608b2018-06-05 17:10:09 -070093
Alex Klein1699fab2022-09-08 08:46:06 -060094 expected = """
Don Garrettbe3608b2018-06-05 17:10:09 -070095trigger {
96 id: "complex"
Vadim Shtayura6398e002021-01-11 12:02:11 -080097 realm: "cbb-jobs"
Don Garrettbe3608b2018-06-05 17:10:09 -070098 acl_sets: "default"
99 schedule: "with 5m interval"
100 gitiles: {
101 repo: "url://repo"
102 refs: "refs/path"
103 refs: "refs/other_path"
104 }
105 triggers: "test_build_a"
106 triggers: "test_build_b"
107}
Mike Frysinger80de5012019-08-01 14:10:53 -0400108"""
Don Garrettbe3608b2018-06-05 17:10:09 -0700109
Alex Klein1699fab2022-09-08 08:46:06 -0600110 result = gen_luci_scheduler.genSchedulerTrigger(
111 trigger_name, repo, refs, None, builds
112 )
Don Garrettbe3608b2018-06-05 17:10:09 -0700113
Alex Klein1699fab2022-09-08 08:46:06 -0600114 self.assertEqual(result, expected)
Don Garrettbe3608b2018-06-05 17:10:09 -0700115
Alex Klein1699fab2022-09-08 08:46:06 -0600116 def testGenSchedulerBranched(self):
117 """Test the job creation helper."""
118 build_config = config_lib_unittest.MockBuildConfig().apply(
119 schedule_branch="mock_branch",
120 schedule="funky schedule",
121 )
Don Garrett8dace272018-07-19 14:07:42 -0700122
Alex Klein1699fab2022-09-08 08:46:06 -0600123 expected = """
Don Garrett8dace272018-07-19 14:07:42 -0700124job {
Mike Nichols9e47e842020-08-11 15:23:56 -0600125 id: "mock_branch-amd64-generic-release"
Vadim Shtayura6398e002021-01-11 12:02:11 -0800126 realm: "cbb-jobs"
Don Garrett8dace272018-07-19 14:07:42 -0700127 acl_sets: "default"
128 schedule: "funky schedule"
129 buildbucket: {
130 server: "cr-buildbucket.appspot.com"
Vadim Shtayura959cb0f2022-02-03 12:45:58 -0800131 bucket: "general"
Mike Nichols9e47e842020-08-11 15:23:56 -0600132 builder: "LegacyRelease"
Don Garrett8dace272018-07-19 14:07:42 -0700133 tags: "cbb_branch:mock_branch"
Mike Nichols9e47e842020-08-11 15:23:56 -0600134 tags: "cbb_config:amd64-generic-release"
Don Garrett73148e52018-08-17 16:54:46 -0700135 tags: "cbb_display_label:MockLabel"
Don Garrett8dace272018-07-19 14:07:42 -0700136 properties: "cbb_branch:mock_branch"
Mike Nichols9e47e842020-08-11 15:23:56 -0600137 properties: "cbb_config:amd64-generic-release"
Don Garrett73148e52018-08-17 16:54:46 -0700138 properties: "cbb_display_label:MockLabel"
139 properties: "cbb_extra_args:[\\"--buildbot\\"]"
140 }
141}
Mike Frysinger80de5012019-08-01 14:10:53 -0400142"""
Don Garrett73148e52018-08-17 16:54:46 -0700143
Alex Klein1699fab2022-09-08 08:46:06 -0600144 result = gen_luci_scheduler.genSchedulerJob(build_config)
145 self.assertEqual(result, expected)
Don Garrett73148e52018-08-17 16:54:46 -0700146
Alex Klein1699fab2022-09-08 08:46:06 -0600147 def testGenSchedulerWorkspaceBranch(self):
148 """Test the job creation helper."""
149 build_config = config_lib_unittest.MockBuildConfig().apply(
150 workspace_branch="work_branch",
151 schedule="funky schedule",
152 )
Don Garrett73148e52018-08-17 16:54:46 -0700153
Alex Klein1699fab2022-09-08 08:46:06 -0600154 expected = """
Don Garrett73148e52018-08-17 16:54:46 -0700155job {
Mike Nichols9e47e842020-08-11 15:23:56 -0600156 id: "amd64-generic-release"
Vadim Shtayura6398e002021-01-11 12:02:11 -0800157 realm: "cbb-jobs"
Don Garrett73148e52018-08-17 16:54:46 -0700158 acl_sets: "default"
159 schedule: "funky schedule"
160 buildbucket: {
161 server: "cr-buildbucket.appspot.com"
Vadim Shtayura959cb0f2022-02-03 12:45:58 -0800162 bucket: "general"
Mike Nichols9e47e842020-08-11 15:23:56 -0600163 builder: "LegacyRelease"
Mike Frysinger62a02452021-03-16 03:48:34 -0400164 tags: "cbb_branch:main"
Mike Nichols9e47e842020-08-11 15:23:56 -0600165 tags: "cbb_config:amd64-generic-release"
Don Garrett73148e52018-08-17 16:54:46 -0700166 tags: "cbb_display_label:MockLabel"
167 tags: "cbb_workspace_branch:work_branch"
Mike Frysinger62a02452021-03-16 03:48:34 -0400168 properties: "cbb_branch:main"
Mike Nichols9e47e842020-08-11 15:23:56 -0600169 properties: "cbb_config:amd64-generic-release"
Don Garrett73148e52018-08-17 16:54:46 -0700170 properties: "cbb_display_label:MockLabel"
171 properties: "cbb_workspace_branch:work_branch"
Don Garrett8dace272018-07-19 14:07:42 -0700172 properties: "cbb_extra_args:[\\"--buildbot\\"]"
173 }
174}
Mike Frysinger80de5012019-08-01 14:10:53 -0400175"""
Don Garrett8dace272018-07-19 14:07:42 -0700176
Alex Klein1699fab2022-09-08 08:46:06 -0600177 result = gen_luci_scheduler.genSchedulerJob(build_config)
178 self.assertEqual(result, expected)
Don Garrett8dace272018-07-19 14:07:42 -0700179
Alex Klein1699fab2022-09-08 08:46:06 -0600180 def testGenSchedulerGomaClientType(self):
181 """Test the job creation helper."""
182 build_config = config_lib_unittest.MockBuildConfig().apply(
183 goma_client_type="client_type",
184 schedule="funky schedule",
185 )
Yoshisato Yanagisawa16285b42018-09-19 14:00:58 +0900186
Alex Klein1699fab2022-09-08 08:46:06 -0600187 expected = """
Yoshisato Yanagisawa16285b42018-09-19 14:00:58 +0900188job {
Mike Nichols9e47e842020-08-11 15:23:56 -0600189 id: "amd64-generic-release"
Vadim Shtayura6398e002021-01-11 12:02:11 -0800190 realm: "cbb-jobs"
Yoshisato Yanagisawa16285b42018-09-19 14:00:58 +0900191 acl_sets: "default"
192 schedule: "funky schedule"
193 buildbucket: {
194 server: "cr-buildbucket.appspot.com"
Vadim Shtayura959cb0f2022-02-03 12:45:58 -0800195 bucket: "general"
Mike Nichols9e47e842020-08-11 15:23:56 -0600196 builder: "LegacyRelease"
Mike Frysinger62a02452021-03-16 03:48:34 -0400197 tags: "cbb_branch:main"
Mike Nichols9e47e842020-08-11 15:23:56 -0600198 tags: "cbb_config:amd64-generic-release"
Yoshisato Yanagisawa16285b42018-09-19 14:00:58 +0900199 tags: "cbb_display_label:MockLabel"
200 tags: "cbb_goma_client_type:client_type"
Mike Frysinger62a02452021-03-16 03:48:34 -0400201 properties: "cbb_branch:main"
Mike Nichols9e47e842020-08-11 15:23:56 -0600202 properties: "cbb_config:amd64-generic-release"
Yoshisato Yanagisawa16285b42018-09-19 14:00:58 +0900203 properties: "cbb_display_label:MockLabel"
204 properties: "cbb_goma_client_type:client_type"
205 properties: "cbb_extra_args:[\\"--buildbot\\"]"
206 }
207}
Mike Frysinger80de5012019-08-01 14:10:53 -0400208"""
Yoshisato Yanagisawa16285b42018-09-19 14:00:58 +0900209
Alex Klein1699fab2022-09-08 08:46:06 -0600210 result = gen_luci_scheduler.genSchedulerJob(build_config)
211 self.assertEqual(result, expected)
Yoshisato Yanagisawa16285b42018-09-19 14:00:58 +0900212
Alex Klein1699fab2022-09-08 08:46:06 -0600213 def testGenLuciSchedulerConfig(self):
214 """Test a full LUCI Scheduler config file."""
215 site_config = config_lib.SiteConfig()
Don Garrettbe3608b2018-06-05 17:10:09 -0700216
Alex Klein1699fab2022-09-08 08:46:06 -0600217 site_config.Add(
218 "not_scheduled",
219 luci_builder="ReleaseBuilder",
220 display_label="MockLabel",
221 )
Don Garrettbe3608b2018-06-05 17:10:09 -0700222
Alex Klein1699fab2022-09-08 08:46:06 -0600223 site_config.Add(
224 "build_prod",
225 luci_builder="ReleaseBuilder",
226 display_label="MockLabel",
227 schedule="run once in a while",
228 )
Don Garrettbe3608b2018-06-05 17:10:09 -0700229
Alex Klein1699fab2022-09-08 08:46:06 -0600230 site_config.Add(
231 "build_tester",
232 luci_builder="TestBuilder",
233 display_label="TestLabel",
234 schedule="run daily",
235 )
Don Garrettbe3608b2018-06-05 17:10:09 -0700236
Alex Klein1699fab2022-09-08 08:46:06 -0600237 site_config.Add(
238 "build_triggered_a",
239 luci_builder="ReleaseBuilder",
240 display_label="MockLabel",
241 schedule="triggered",
242 triggered_gitiles=[
243 [
244 "gitiles_url_a",
245 ["ref_a", "ref_b"],
246 ],
247 [
248 "gitiles_url_b",
249 ["ref_c"],
250 ],
251 ],
252 )
Don Garrettbe3608b2018-06-05 17:10:09 -0700253
Alex Klein1699fab2022-09-08 08:46:06 -0600254 site_config.Add(
255 "build_triggered_b",
256 luci_builder="ProdBuilder",
257 display_label="MockLabel",
258 schedule="triggered",
259 triggered_gitiles=[
260 [
261 "gitiles_url_b",
262 ["ref_c"],
263 ]
264 ],
265 )
Don Garrettbe3608b2018-06-05 17:10:09 -0700266
Alex Klein1699fab2022-09-08 08:46:06 -0600267 default_config = config_lib.GetConfig().GetDefault()
Don Garrett8dace272018-07-19 14:07:42 -0700268
Alex Klein1699fab2022-09-08 08:46:06 -0600269 branch_configs = [
270 default_config.derive(
271 name="branch_tester",
272 luci_builder="TestBuilder",
273 display_label="TestLabel",
274 schedule="run daily",
275 schedule_branch="test-branch",
276 ),
277 default_config.derive(
278 name="branch_tester_triggered",
279 luci_builder="TestBuilder",
280 display_label="TestLabel",
281 schedule="run daily",
282 schedule_branch="test-branch",
283 triggered_gitiles=[
284 [
285 "gitiles_url_a",
286 ["ref_a", "ref_b"],
287 ]
288 ],
289 ),
290 ]
Don Garrett8dace272018-07-19 14:07:42 -0700291
Alex Klein1699fab2022-09-08 08:46:06 -0600292 expected = """# Defines buckets on luci-scheduler.appspot.com.
Don Garrettbe3608b2018-06-05 17:10:09 -0700293#
294# For schema of this file and documentation see ProjectConfig message in
Mike Frysinger92dc6492021-02-17 16:01:09 -0500295# https://github.com/luci/luci-go/blob/HEAD/scheduler/appengine/messages/config.proto
Don Garrettbe3608b2018-06-05 17:10:09 -0700296
297# Generated with chromite/scripts/gen_luci_scheduler
298
Don Garrettff45f4b2018-10-04 09:08:01 -0700299# Autodeployed with:
Mike Nicholsb575c612021-04-09 10:04:43 -0600300# https://data.corp.google.com/sites/chromeos_ci_cros_ci_builds/utility/?f=board_name:in:luci-scheduler-updater
Don Garrettff45f4b2018-10-04 09:08:01 -0700301
Don Garrettbe3608b2018-06-05 17:10:09 -0700302acl_sets {
303 name: "default"
304 acls {
305 role: READER
306 granted_to: "group:googlers"
307 }
308 acls {
309 role: OWNER
310 granted_to: "group:project-chromeos-admins"
311 }
Jason D. Clintona9e374a2018-10-18 18:41:00 -0600312 acls {
313 role: TRIGGERER
314 granted_to: "group:mdb/chromeos-build-access"
LaMont Jones48ddfd92020-09-16 13:46:41 -0600315 }
316 acls {
317 role: TRIGGERER
LaMont Jonesd1bb0002020-09-16 09:35:10 -0600318 granted_to: "group:project-chromeos-buildbucket-schedulers"
Jason D. Clintona9e374a2018-10-18 18:41:00 -0600319 }
Don Garrettbe3608b2018-06-05 17:10:09 -0700320}
321
322trigger {
323 id: "trigger_0"
Vadim Shtayura6398e002021-01-11 12:02:11 -0800324 realm: "cbb-jobs"
Don Garrettbe3608b2018-06-05 17:10:09 -0700325 acl_sets: "default"
326 schedule: "with 5m interval"
327 gitiles: {
328 repo: "gitiles_url_a"
329 refs: "ref_a"
330 refs: "ref_b"
331 }
332 triggers: "build_triggered_a"
Don Garrett9a0d90c2018-10-30 12:47:14 -0700333 triggers: "test-branch-branch_tester_triggered"
Don Garrettbe3608b2018-06-05 17:10:09 -0700334}
335
336trigger {
337 id: "trigger_1"
Vadim Shtayura6398e002021-01-11 12:02:11 -0800338 realm: "cbb-jobs"
Don Garrettbe3608b2018-06-05 17:10:09 -0700339 acl_sets: "default"
340 schedule: "with 5m interval"
341 gitiles: {
342 repo: "gitiles_url_b"
343 refs: "ref_c"
344 }
345 triggers: "build_triggered_a"
346 triggers: "build_triggered_b"
347}
348
349job {
350 id: "build_prod"
Vadim Shtayura6398e002021-01-11 12:02:11 -0800351 realm: "cbb-jobs"
Don Garrettbe3608b2018-06-05 17:10:09 -0700352 acl_sets: "default"
353 schedule: "run once in a while"
354 buildbucket: {
355 server: "cr-buildbucket.appspot.com"
Vadim Shtayura959cb0f2022-02-03 12:45:58 -0800356 bucket: "general"
Mike Nichols9e47e842020-08-11 15:23:56 -0600357 builder: "ReleaseBuilder"
Mike Frysinger62a02452021-03-16 03:48:34 -0400358 tags: "cbb_branch:main"
Don Garrettbe3608b2018-06-05 17:10:09 -0700359 tags: "cbb_config:build_prod"
Don Garrett73148e52018-08-17 16:54:46 -0700360 tags: "cbb_display_label:MockLabel"
Mike Frysinger62a02452021-03-16 03:48:34 -0400361 properties: "cbb_branch:main"
Don Garrettbe3608b2018-06-05 17:10:09 -0700362 properties: "cbb_config:build_prod"
Don Garrett73148e52018-08-17 16:54:46 -0700363 properties: "cbb_display_label:MockLabel"
Don Garrettbe3608b2018-06-05 17:10:09 -0700364 properties: "cbb_extra_args:[\\"--buildbot\\"]"
365 }
366}
367
368job {
369 id: "build_tester"
Vadim Shtayura6398e002021-01-11 12:02:11 -0800370 realm: "cbb-jobs"
Don Garrettbe3608b2018-06-05 17:10:09 -0700371 acl_sets: "default"
372 schedule: "run daily"
373 buildbucket: {
374 server: "cr-buildbucket.appspot.com"
Vadim Shtayura959cb0f2022-02-03 12:45:58 -0800375 bucket: "general"
Don Garrettbe3608b2018-06-05 17:10:09 -0700376 builder: "TestBuilder"
Mike Frysinger62a02452021-03-16 03:48:34 -0400377 tags: "cbb_branch:main"
Don Garrettbe3608b2018-06-05 17:10:09 -0700378 tags: "cbb_config:build_tester"
Don Garrett73148e52018-08-17 16:54:46 -0700379 tags: "cbb_display_label:TestLabel"
Mike Frysinger62a02452021-03-16 03:48:34 -0400380 properties: "cbb_branch:main"
Don Garrettbe3608b2018-06-05 17:10:09 -0700381 properties: "cbb_config:build_tester"
Don Garrett73148e52018-08-17 16:54:46 -0700382 properties: "cbb_display_label:TestLabel"
Don Garrettbe3608b2018-06-05 17:10:09 -0700383 properties: "cbb_extra_args:[\\"--buildbot\\"]"
384 }
385}
386
387job {
388 id: "build_triggered_a"
Vadim Shtayura6398e002021-01-11 12:02:11 -0800389 realm: "cbb-jobs"
Don Garrettbe3608b2018-06-05 17:10:09 -0700390 acl_sets: "default"
391 schedule: "triggered"
392 buildbucket: {
393 server: "cr-buildbucket.appspot.com"
Vadim Shtayura959cb0f2022-02-03 12:45:58 -0800394 bucket: "general"
Mike Nichols9e47e842020-08-11 15:23:56 -0600395 builder: "ReleaseBuilder"
Mike Frysinger62a02452021-03-16 03:48:34 -0400396 tags: "cbb_branch:main"
Don Garrettbe3608b2018-06-05 17:10:09 -0700397 tags: "cbb_config:build_triggered_a"
Don Garrett73148e52018-08-17 16:54:46 -0700398 tags: "cbb_display_label:MockLabel"
Mike Frysinger62a02452021-03-16 03:48:34 -0400399 properties: "cbb_branch:main"
Don Garrettbe3608b2018-06-05 17:10:09 -0700400 properties: "cbb_config:build_triggered_a"
Don Garrett73148e52018-08-17 16:54:46 -0700401 properties: "cbb_display_label:MockLabel"
Don Garrettbe3608b2018-06-05 17:10:09 -0700402 properties: "cbb_extra_args:[\\"--buildbot\\"]"
403 }
404}
405
406job {
407 id: "build_triggered_b"
Vadim Shtayura6398e002021-01-11 12:02:11 -0800408 realm: "cbb-jobs"
Don Garrettbe3608b2018-06-05 17:10:09 -0700409 acl_sets: "default"
410 schedule: "triggered"
411 buildbucket: {
412 server: "cr-buildbucket.appspot.com"
Vadim Shtayura959cb0f2022-02-03 12:45:58 -0800413 bucket: "general"
Don Garrettbe3608b2018-06-05 17:10:09 -0700414 builder: "ProdBuilder"
Mike Frysinger62a02452021-03-16 03:48:34 -0400415 tags: "cbb_branch:main"
Don Garrettbe3608b2018-06-05 17:10:09 -0700416 tags: "cbb_config:build_triggered_b"
Don Garrett73148e52018-08-17 16:54:46 -0700417 tags: "cbb_display_label:MockLabel"
Mike Frysinger62a02452021-03-16 03:48:34 -0400418 properties: "cbb_branch:main"
Don Garrettbe3608b2018-06-05 17:10:09 -0700419 properties: "cbb_config:build_triggered_b"
Don Garrett73148e52018-08-17 16:54:46 -0700420 properties: "cbb_display_label:MockLabel"
Don Garrettbe3608b2018-06-05 17:10:09 -0700421 properties: "cbb_extra_args:[\\"--buildbot\\"]"
422 }
423}
Don Garrett8dace272018-07-19 14:07:42 -0700424
425job {
426 id: "test-branch-branch_tester"
Vadim Shtayura6398e002021-01-11 12:02:11 -0800427 realm: "cbb-jobs"
Don Garrett8dace272018-07-19 14:07:42 -0700428 acl_sets: "default"
429 schedule: "run daily"
430 buildbucket: {
431 server: "cr-buildbucket.appspot.com"
Vadim Shtayura959cb0f2022-02-03 12:45:58 -0800432 bucket: "general"
Don Garrett8dace272018-07-19 14:07:42 -0700433 builder: "TestBuilder"
434 tags: "cbb_branch:test-branch"
Don Garrett8dace272018-07-19 14:07:42 -0700435 tags: "cbb_config:branch_tester"
Don Garrett73148e52018-08-17 16:54:46 -0700436 tags: "cbb_display_label:TestLabel"
Don Garrett8dace272018-07-19 14:07:42 -0700437 properties: "cbb_branch:test-branch"
Don Garrett8dace272018-07-19 14:07:42 -0700438 properties: "cbb_config:branch_tester"
Don Garrett73148e52018-08-17 16:54:46 -0700439 properties: "cbb_display_label:TestLabel"
Don Garrett8dace272018-07-19 14:07:42 -0700440 properties: "cbb_extra_args:[\\"--buildbot\\"]"
441 }
442}
Don Garrett9a0d90c2018-10-30 12:47:14 -0700443
444job {
445 id: "test-branch-branch_tester_triggered"
Vadim Shtayura6398e002021-01-11 12:02:11 -0800446 realm: "cbb-jobs"
Don Garrett9a0d90c2018-10-30 12:47:14 -0700447 acl_sets: "default"
448 schedule: "run daily"
449 buildbucket: {
450 server: "cr-buildbucket.appspot.com"
Vadim Shtayura959cb0f2022-02-03 12:45:58 -0800451 bucket: "general"
Don Garrett9a0d90c2018-10-30 12:47:14 -0700452 builder: "TestBuilder"
453 tags: "cbb_branch:test-branch"
454 tags: "cbb_config:branch_tester_triggered"
455 tags: "cbb_display_label:TestLabel"
456 properties: "cbb_branch:test-branch"
457 properties: "cbb_config:branch_tester_triggered"
458 properties: "cbb_display_label:TestLabel"
459 properties: "cbb_extra_args:[\\"--buildbot\\"]"
460 }
461}
Mike Frysinger80de5012019-08-01 14:10:53 -0400462"""
Alex Klein1699fab2022-09-08 08:46:06 -0600463 result = gen_luci_scheduler.genLuciSchedulerConfig(
464 site_config, branch_configs
465 )
Don Garrettbe3608b2018-06-05 17:10:09 -0700466
Alex Klein1699fab2022-09-08 08:46:06 -0600467 self.assertEqual(result, expected)