Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | # Copyright 2018 The Chromium OS Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
| 6 | """Test gen_luci_scheduler.""" |
| 7 | from __future__ import print_function |
| 8 | |
Mike Frysinger | 74a6cc8 | 2020-02-14 14:16:22 -0500 | [diff] [blame] | 9 | import sys |
| 10 | |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 11 | from chromite.config import chromeos_config |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 12 | from chromite.lib import cros_test_lib |
| 13 | from chromite.lib import config_lib |
| 14 | from chromite.lib import config_lib_unittest |
| 15 | from chromite.scripts import gen_luci_scheduler |
| 16 | |
Mike Frysinger | 74a6cc8 | 2020-02-14 14:16:22 -0500 | [diff] [blame] | 17 | |
| 18 | assert sys.version_info >= (3, 6), 'This module requires Python 3.6+' |
| 19 | |
| 20 | |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 21 | # It's reasonable for unittests to look at internals. |
| 22 | # pylint: disable=protected-access |
| 23 | |
| 24 | |
| 25 | class GenLuciSchedulerTest(cros_test_lib.MockTestCase): |
| 26 | """Tests for cbuildbot_launch script.""" |
| 27 | def testSanityAgainstProd(self): |
| 28 | """Test we can generate a luci scheduler config with live data.""" |
| 29 | # If it runs without crashing, we pass. |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 30 | gen_luci_scheduler.genLuciSchedulerConfig( |
| 31 | config_lib.GetConfig(), chromeos_config.BranchScheduleConfig()) |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 32 | |
| 33 | def testGenSchedulerJob(self): |
| 34 | """Test the job creation helper.""" |
| 35 | build_config = config_lib_unittest.MockBuildConfig().apply( |
| 36 | schedule='funky schedule' |
| 37 | ) |
| 38 | |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 39 | expected = """ |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 40 | job { |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 41 | id: "amd64-generic-release" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 42 | acl_sets: "default" |
| 43 | schedule: "funky schedule" |
| 44 | buildbucket: { |
| 45 | server: "cr-buildbucket.appspot.com" |
| 46 | bucket: "luci.chromeos.general" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 47 | builder: "LegacyRelease" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 48 | tags: "cbb_branch:master" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 49 | tags: "cbb_config:amd64-generic-release" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 50 | tags: "cbb_display_label:MockLabel" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 51 | properties: "cbb_branch:master" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 52 | properties: "cbb_config:amd64-generic-release" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 53 | properties: "cbb_display_label:MockLabel" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 54 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 55 | } |
| 56 | } |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 57 | """ |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 58 | |
| 59 | result = gen_luci_scheduler.genSchedulerJob(build_config) |
| 60 | self.assertEqual(result, expected) |
| 61 | |
| 62 | def testGenSchedulerTriggerSimple(self): |
| 63 | """Test the trigger creation helper.""" |
| 64 | trigger_name = 'simple' |
| 65 | repo = 'url://repo' |
| 66 | refs = ['refs/path'] |
David Burger | cba0d27 | 2020-06-24 16:21:26 -0600 | [diff] [blame] | 67 | path_regexps = ['path/regexps'] |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 68 | builds = ['test_build'] |
| 69 | |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 70 | expected = """ |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 71 | trigger { |
| 72 | id: "simple" |
| 73 | acl_sets: "default" |
| 74 | schedule: "with 5m interval" |
| 75 | gitiles: { |
| 76 | repo: "url://repo" |
| 77 | refs: "refs/path" |
David Burger | cba0d27 | 2020-06-24 16:21:26 -0600 | [diff] [blame] | 78 | path_regexps: "path/regexps" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 79 | } |
| 80 | triggers: "test_build" |
| 81 | } |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 82 | """ |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 83 | |
| 84 | result = gen_luci_scheduler.genSchedulerTrigger( |
David Burger | cba0d27 | 2020-06-24 16:21:26 -0600 | [diff] [blame] | 85 | trigger_name, repo, refs, path_regexps, builds) |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 86 | |
| 87 | self.assertEqual(result, expected) |
| 88 | |
| 89 | def testGenSchedulerTriggerComplex(self): |
| 90 | """Test the trigger creation helper.""" |
| 91 | trigger_name = 'complex' |
| 92 | repo = 'url://repo' |
| 93 | refs = ['refs/path', 'refs/other_path'] |
| 94 | builds = ['test_build_a', 'test_build_b'] |
| 95 | |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 96 | expected = """ |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 97 | trigger { |
| 98 | id: "complex" |
| 99 | acl_sets: "default" |
| 100 | schedule: "with 5m interval" |
| 101 | gitiles: { |
| 102 | repo: "url://repo" |
| 103 | refs: "refs/path" |
| 104 | refs: "refs/other_path" |
| 105 | } |
| 106 | triggers: "test_build_a" |
| 107 | triggers: "test_build_b" |
| 108 | } |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 109 | """ |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 110 | |
| 111 | result = gen_luci_scheduler.genSchedulerTrigger( |
David Burger | cba0d27 | 2020-06-24 16:21:26 -0600 | [diff] [blame] | 112 | trigger_name, repo, refs, None, builds) |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 113 | |
| 114 | self.assertEqual(result, expected) |
| 115 | |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 116 | |
| 117 | def testGenSchedulerBranched(self): |
| 118 | """Test the job creation helper.""" |
| 119 | build_config = config_lib_unittest.MockBuildConfig().apply( |
| 120 | schedule_branch='mock_branch', |
| 121 | schedule='funky schedule', |
| 122 | ) |
| 123 | |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 124 | expected = """ |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 125 | job { |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 126 | id: "mock_branch-amd64-generic-release" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 127 | acl_sets: "default" |
| 128 | schedule: "funky schedule" |
| 129 | buildbucket: { |
| 130 | server: "cr-buildbucket.appspot.com" |
| 131 | bucket: "luci.chromeos.general" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 132 | builder: "LegacyRelease" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 133 | tags: "cbb_branch:mock_branch" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 134 | tags: "cbb_config:amd64-generic-release" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 135 | tags: "cbb_display_label:MockLabel" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 136 | properties: "cbb_branch:mock_branch" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 137 | properties: "cbb_config:amd64-generic-release" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 138 | properties: "cbb_display_label:MockLabel" |
| 139 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 140 | } |
| 141 | } |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 142 | """ |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 143 | |
| 144 | result = gen_luci_scheduler.genSchedulerJob(build_config) |
| 145 | self.assertEqual(result, expected) |
| 146 | |
| 147 | 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 | ) |
| 153 | |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 154 | expected = """ |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 155 | job { |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 156 | id: "amd64-generic-release" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 157 | acl_sets: "default" |
| 158 | schedule: "funky schedule" |
| 159 | buildbucket: { |
| 160 | server: "cr-buildbucket.appspot.com" |
| 161 | bucket: "luci.chromeos.general" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 162 | builder: "LegacyRelease" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 163 | tags: "cbb_branch:master" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 164 | tags: "cbb_config:amd64-generic-release" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 165 | tags: "cbb_display_label:MockLabel" |
| 166 | tags: "cbb_workspace_branch:work_branch" |
| 167 | properties: "cbb_branch:master" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 168 | properties: "cbb_config:amd64-generic-release" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 169 | properties: "cbb_display_label:MockLabel" |
| 170 | properties: "cbb_workspace_branch:work_branch" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 171 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 172 | } |
| 173 | } |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 174 | """ |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 175 | |
| 176 | result = gen_luci_scheduler.genSchedulerJob(build_config) |
| 177 | self.assertEqual(result, expected) |
| 178 | |
Yoshisato Yanagisawa | 16285b4 | 2018-09-19 14:00:58 +0900 | [diff] [blame] | 179 | def testGenSchedulerGomaClientType(self): |
| 180 | """Test the job creation helper.""" |
| 181 | build_config = config_lib_unittest.MockBuildConfig().apply( |
| 182 | goma_client_type='client_type', |
| 183 | schedule='funky schedule', |
| 184 | ) |
| 185 | |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 186 | expected = """ |
Yoshisato Yanagisawa | 16285b4 | 2018-09-19 14:00:58 +0900 | [diff] [blame] | 187 | job { |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 188 | id: "amd64-generic-release" |
Yoshisato Yanagisawa | 16285b4 | 2018-09-19 14:00:58 +0900 | [diff] [blame] | 189 | acl_sets: "default" |
| 190 | schedule: "funky schedule" |
| 191 | buildbucket: { |
| 192 | server: "cr-buildbucket.appspot.com" |
| 193 | bucket: "luci.chromeos.general" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 194 | builder: "LegacyRelease" |
Yoshisato Yanagisawa | 16285b4 | 2018-09-19 14:00:58 +0900 | [diff] [blame] | 195 | tags: "cbb_branch:master" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 196 | tags: "cbb_config:amd64-generic-release" |
Yoshisato Yanagisawa | 16285b4 | 2018-09-19 14:00:58 +0900 | [diff] [blame] | 197 | tags: "cbb_display_label:MockLabel" |
| 198 | tags: "cbb_goma_client_type:client_type" |
| 199 | properties: "cbb_branch:master" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 200 | properties: "cbb_config:amd64-generic-release" |
Yoshisato Yanagisawa | 16285b4 | 2018-09-19 14:00:58 +0900 | [diff] [blame] | 201 | properties: "cbb_display_label:MockLabel" |
| 202 | properties: "cbb_goma_client_type:client_type" |
| 203 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 204 | } |
| 205 | } |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 206 | """ |
Yoshisato Yanagisawa | 16285b4 | 2018-09-19 14:00:58 +0900 | [diff] [blame] | 207 | |
| 208 | result = gen_luci_scheduler.genSchedulerJob(build_config) |
| 209 | self.assertEqual(result, expected) |
| 210 | |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 211 | def testGenLuciSchedulerConfig(self): |
| 212 | """Test a full LUCI Scheduler config file.""" |
| 213 | site_config = config_lib.SiteConfig() |
| 214 | |
| 215 | site_config.Add( |
| 216 | 'not_scheduled', |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 217 | luci_builder='ReleaseBuilder', |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 218 | display_label='MockLabel', |
| 219 | ) |
| 220 | |
| 221 | site_config.Add( |
| 222 | 'build_prod', |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 223 | luci_builder='ReleaseBuilder', |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 224 | display_label='MockLabel', |
| 225 | schedule='run once in a while', |
| 226 | ) |
| 227 | |
| 228 | site_config.Add( |
| 229 | 'build_tester', |
| 230 | luci_builder='TestBuilder', |
| 231 | display_label='TestLabel', |
| 232 | schedule='run daily', |
| 233 | ) |
| 234 | |
| 235 | site_config.Add( |
| 236 | 'build_triggered_a', |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 237 | luci_builder='ReleaseBuilder', |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 238 | display_label='MockLabel', |
| 239 | schedule='triggered', |
| 240 | triggered_gitiles=[[ |
| 241 | 'gitiles_url_a', |
| 242 | ['ref_a', 'ref_b'], |
| 243 | ], [ |
| 244 | 'gitiles_url_b', |
| 245 | ['ref_c'], |
| 246 | ]], |
| 247 | ) |
| 248 | |
| 249 | site_config.Add( |
| 250 | 'build_triggered_b', |
| 251 | luci_builder='ProdBuilder', |
| 252 | display_label='MockLabel', |
| 253 | schedule='triggered', |
| 254 | triggered_gitiles=[[ |
| 255 | 'gitiles_url_b', |
| 256 | ['ref_c'], |
| 257 | ]], |
| 258 | ) |
| 259 | |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 260 | default_config = config_lib.GetConfig().GetDefault() |
| 261 | |
| 262 | branch_configs = [ |
| 263 | default_config.derive( |
| 264 | name='branch_tester', |
| 265 | luci_builder='TestBuilder', |
| 266 | display_label='TestLabel', |
| 267 | schedule='run daily', |
| 268 | schedule_branch='test-branch', |
| 269 | ), |
Don Garrett | 9a0d90c | 2018-10-30 12:47:14 -0700 | [diff] [blame] | 270 | default_config.derive( |
| 271 | name='branch_tester_triggered', |
| 272 | luci_builder='TestBuilder', |
| 273 | display_label='TestLabel', |
| 274 | schedule='run daily', |
| 275 | schedule_branch='test-branch', |
| 276 | triggered_gitiles=[[ |
| 277 | 'gitiles_url_a', |
| 278 | ['ref_a', 'ref_b'], |
| 279 | ]], |
| 280 | ), |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 281 | ] |
| 282 | |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 283 | expected = """# Defines buckets on luci-scheduler.appspot.com. |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 284 | # |
| 285 | # For schema of this file and documentation see ProjectConfig message in |
| 286 | # https://github.com/luci/luci-go/blob/master/scheduler/appengine/messages/config.proto |
| 287 | |
| 288 | # Generated with chromite/scripts/gen_luci_scheduler |
| 289 | |
Don Garrett | ff45f4b | 2018-10-04 09:08:01 -0700 | [diff] [blame] | 290 | # Autodeployed with: |
| 291 | # http://cros-goldeneye/chromeos/legoland/builderHistory?buildConfig=luci-scheduler-updater |
| 292 | |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 293 | acl_sets { |
| 294 | name: "default" |
| 295 | acls { |
| 296 | role: READER |
| 297 | granted_to: "group:googlers" |
| 298 | } |
| 299 | acls { |
| 300 | role: OWNER |
| 301 | granted_to: "group:project-chromeos-admins" |
| 302 | } |
Jason D. Clinton | a9e374a | 2018-10-18 18:41:00 -0600 | [diff] [blame] | 303 | acls { |
| 304 | role: TRIGGERER |
| 305 | granted_to: "group:mdb/chromeos-build-access" |
LaMont Jones | 48ddfd9 | 2020-09-16 13:46:41 -0600 | [diff] [blame] | 306 | } |
| 307 | acls { |
| 308 | role: TRIGGERER |
LaMont Jones | d1bb000 | 2020-09-16 09:35:10 -0600 | [diff] [blame] | 309 | granted_to: "group:project-chromeos-buildbucket-schedulers" |
Jason D. Clinton | a9e374a | 2018-10-18 18:41:00 -0600 | [diff] [blame] | 310 | } |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | trigger { |
| 314 | id: "trigger_0" |
| 315 | acl_sets: "default" |
| 316 | schedule: "with 5m interval" |
| 317 | gitiles: { |
| 318 | repo: "gitiles_url_a" |
| 319 | refs: "ref_a" |
| 320 | refs: "ref_b" |
| 321 | } |
| 322 | triggers: "build_triggered_a" |
Don Garrett | 9a0d90c | 2018-10-30 12:47:14 -0700 | [diff] [blame] | 323 | triggers: "test-branch-branch_tester_triggered" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 324 | } |
| 325 | |
| 326 | trigger { |
| 327 | id: "trigger_1" |
| 328 | acl_sets: "default" |
| 329 | schedule: "with 5m interval" |
| 330 | gitiles: { |
| 331 | repo: "gitiles_url_b" |
| 332 | refs: "ref_c" |
| 333 | } |
| 334 | triggers: "build_triggered_a" |
| 335 | triggers: "build_triggered_b" |
| 336 | } |
| 337 | |
| 338 | job { |
| 339 | id: "build_prod" |
| 340 | acl_sets: "default" |
| 341 | schedule: "run once in a while" |
| 342 | buildbucket: { |
| 343 | server: "cr-buildbucket.appspot.com" |
| 344 | bucket: "luci.chromeos.general" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 345 | builder: "ReleaseBuilder" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 346 | tags: "cbb_branch:master" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 347 | tags: "cbb_config:build_prod" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 348 | tags: "cbb_display_label:MockLabel" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 349 | properties: "cbb_branch:master" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 350 | properties: "cbb_config:build_prod" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 351 | properties: "cbb_display_label:MockLabel" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 352 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | job { |
| 357 | id: "build_tester" |
| 358 | acl_sets: "default" |
| 359 | schedule: "run daily" |
| 360 | buildbucket: { |
| 361 | server: "cr-buildbucket.appspot.com" |
| 362 | bucket: "luci.chromeos.general" |
| 363 | builder: "TestBuilder" |
| 364 | tags: "cbb_branch:master" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 365 | tags: "cbb_config:build_tester" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 366 | tags: "cbb_display_label:TestLabel" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 367 | properties: "cbb_branch:master" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 368 | properties: "cbb_config:build_tester" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 369 | properties: "cbb_display_label:TestLabel" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 370 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | job { |
| 375 | id: "build_triggered_a" |
| 376 | acl_sets: "default" |
| 377 | schedule: "triggered" |
| 378 | buildbucket: { |
| 379 | server: "cr-buildbucket.appspot.com" |
| 380 | bucket: "luci.chromeos.general" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 381 | builder: "ReleaseBuilder" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 382 | tags: "cbb_branch:master" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 383 | tags: "cbb_config:build_triggered_a" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 384 | tags: "cbb_display_label:MockLabel" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 385 | properties: "cbb_branch:master" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 386 | properties: "cbb_config:build_triggered_a" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 387 | properties: "cbb_display_label:MockLabel" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 388 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | job { |
| 393 | id: "build_triggered_b" |
| 394 | acl_sets: "default" |
| 395 | schedule: "triggered" |
| 396 | buildbucket: { |
| 397 | server: "cr-buildbucket.appspot.com" |
| 398 | bucket: "luci.chromeos.general" |
| 399 | builder: "ProdBuilder" |
| 400 | tags: "cbb_branch:master" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 401 | tags: "cbb_config:build_triggered_b" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 402 | tags: "cbb_display_label:MockLabel" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 403 | properties: "cbb_branch:master" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 404 | properties: "cbb_config:build_triggered_b" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 405 | properties: "cbb_display_label:MockLabel" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 406 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 407 | } |
| 408 | } |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 409 | |
| 410 | job { |
| 411 | id: "test-branch-branch_tester" |
| 412 | acl_sets: "default" |
| 413 | schedule: "run daily" |
| 414 | buildbucket: { |
| 415 | server: "cr-buildbucket.appspot.com" |
| 416 | bucket: "luci.chromeos.general" |
| 417 | builder: "TestBuilder" |
| 418 | tags: "cbb_branch:test-branch" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 419 | tags: "cbb_config:branch_tester" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 420 | tags: "cbb_display_label:TestLabel" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 421 | properties: "cbb_branch:test-branch" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 422 | properties: "cbb_config:branch_tester" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 423 | properties: "cbb_display_label:TestLabel" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 424 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 425 | } |
| 426 | } |
Don Garrett | 9a0d90c | 2018-10-30 12:47:14 -0700 | [diff] [blame] | 427 | |
| 428 | job { |
| 429 | id: "test-branch-branch_tester_triggered" |
| 430 | acl_sets: "default" |
| 431 | schedule: "run daily" |
| 432 | buildbucket: { |
| 433 | server: "cr-buildbucket.appspot.com" |
| 434 | bucket: "luci.chromeos.general" |
| 435 | builder: "TestBuilder" |
| 436 | tags: "cbb_branch:test-branch" |
| 437 | tags: "cbb_config:branch_tester_triggered" |
| 438 | tags: "cbb_display_label:TestLabel" |
| 439 | properties: "cbb_branch:test-branch" |
| 440 | properties: "cbb_config:branch_tester_triggered" |
| 441 | properties: "cbb_display_label:TestLabel" |
| 442 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 443 | } |
| 444 | } |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 445 | """ |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 446 | result = gen_luci_scheduler.genLuciSchedulerConfig( |
| 447 | site_config, branch_configs) |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 448 | |
| 449 | self.assertEqual(result, expected) |