OLD | NEW |
1 // Copyright 2015 The LUCI Authors. | 1 // Copyright 2015 The LUCI Authors. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 So(projects, ShouldResemble, []string{"broken", "project
1", "project2"}) | 201 So(projects, ShouldResemble, []string{"broken", "project
1", "project2"}) |
202 }) | 202 }) |
203 | 203 |
204 Convey("GetProjectJobs works", func() { | 204 Convey("GetProjectJobs works", func() { |
205 defs, err := cat.GetProjectJobs(ctx, "project1") | 205 defs, err := cat.GetProjectJobs(ctx, "project1") |
206 So(err, ShouldBeNil) | 206 So(err, ShouldBeNil) |
207 So(defs, ShouldResemble, []Definition{ | 207 So(defs, ShouldResemble, []Definition{ |
208 { | 208 { |
209 JobID: "project1/noop-job-1", | 209 JobID: "project1/noop-job-1", |
210 Acls: acl.GrantsByRole{Readers: []st
ring{"group:all"}, Owners: []string{"group:some-admins"}}, | 210 Acls: acl.GrantsByRole{Readers: []st
ring{"group:all"}, Owners: []string{"group:some-admins"}}, |
211 » » » » » Revision: "ad93dac7f33309b6e5f3b53d6206d
1b9361f83db", | 211 » » » » » Revision: "847cf9c217f7bad214805f3bea7a3
0799383940b", |
212 Schedule: "*/10 * * * * * *", | 212 Schedule: "*/10 * * * * * *", |
213 Task: []uint8{0xa, 0x0}, | 213 Task: []uint8{0xa, 0x0}, |
214 }, | 214 }, |
215 { | 215 { |
216 JobID: "project1/noop-job-2", | 216 JobID: "project1/noop-job-2", |
217 Acls: acl.GrantsByRole{Readers: []st
ring{"group:all"}, Owners: []string{"group:some-admins"}}, | 217 Acls: acl.GrantsByRole{Readers: []st
ring{"group:all"}, Owners: []string{"group:some-admins"}}, |
218 » » » » » Revision: "ad93dac7f33309b6e5f3b53d6206d
1b9361f83db", | 218 » » » » » Revision: "847cf9c217f7bad214805f3bea7a3
0799383940b", |
219 Schedule: "*/10 * * * * * *", | 219 Schedule: "*/10 * * * * * *", |
220 Task: []uint8{0xa, 0x0}, | 220 Task: []uint8{0xa, 0x0}, |
221 }, | 221 }, |
222 { | 222 { |
223 JobID: "project1/missing-acls", | |
224 Acls: acl.GrantsByRole{[]string{}, [
]string{}}, | |
225 Revision: "ad93dac7f33309b6e5f3b53d6206d
1b9361f83db", | |
226 Schedule: "*/5 * * * * * *", | |
227 Task: []uint8{0xa, 0x0}, | |
228 }, | |
229 { | |
230 JobID: "project1/urlfetch-job-1", | 223 JobID: "project1/urlfetch-job-1", |
231 Acls: acl.GrantsByRole{Readers: []st
ring{"group:all"}, Owners: []string{"group:debuggers", "group:some-admins"}}, | 224 Acls: acl.GrantsByRole{Readers: []st
ring{"group:all"}, Owners: []string{"group:debuggers", "group:some-admins"}}, |
232 » » » » » Revision: "ad93dac7f33309b6e5f3b53d6206d
1b9361f83db", | 225 » » » » » Revision: "847cf9c217f7bad214805f3bea7a3
0799383940b", |
233 Schedule: "*/10 * * * * * *", | 226 Schedule: "*/10 * * * * * *", |
234 Task: []uint8{18, 21, 18, 19, 104, 1
16, 116, 112, 115, 58, 47, 47, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 10
9}, | 227 Task: []uint8{18, 21, 18, 19, 104, 1
16, 116, 112, 115, 58, 47, 47, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 10
9}, |
235 }, | 228 }, |
236 { | 229 { |
237 JobID: "project1/urlfetch-job-2", | 230 JobID: "project1/urlfetch-job-2", |
238 Acls: acl.GrantsByRole{Readers: []st
ring{"group:all"}, Owners: []string{"group:some-admins"}}, | 231 Acls: acl.GrantsByRole{Readers: []st
ring{"group:all"}, Owners: []string{"group:some-admins"}}, |
239 » » » » » Revision: "ad93dac7f33309b6e5f3b53d6206d
1b9361f83db", | 232 » » » » » Revision: "847cf9c217f7bad214805f3bea7a3
0799383940b", |
240 Schedule: "*/10 * * * * * *", | 233 Schedule: "*/10 * * * * * *", |
241 Task: []uint8{18, 21, 18, 19, 104, 1
16, 116, 112, 115, 58, 47, 47, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 10
9}, | 234 Task: []uint8{18, 21, 18, 19, 104, 1
16, 116, 112, 115, 58, 47, 47, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 10
9}, |
242 }, | 235 }, |
243 }) | 236 }) |
244 | 237 |
245 // Make sure URL fetch jobs are parsed correctly and ide
ntically. | 238 // Make sure URL fetch jobs are parsed correctly and ide
ntically. |
246 » » » newStyleDef := defs[3].Task | 239 » » » newStyleDef := defs[2].Task |
247 » » » oldStyleDef := defs[4].Task | 240 » » » oldStyleDef := defs[3].Task |
248 So(newStyleDef, ShouldResemble, oldStyleDef) | 241 So(newStyleDef, ShouldResemble, oldStyleDef) |
249 msg := messages.TaskDefWrapper{} | 242 msg := messages.TaskDefWrapper{} |
250 proto.Unmarshal(newStyleDef, &msg) | 243 proto.Unmarshal(newStyleDef, &msg) |
251 So(msg, ShouldResemble, messages.TaskDefWrapper{ | 244 So(msg, ShouldResemble, messages.TaskDefWrapper{ |
252 UrlFetch: &messages.UrlFetchTask{ | 245 UrlFetch: &messages.UrlFetchTask{ |
253 Url: "https://example.com", | 246 Url: "https://example.com", |
254 }, | 247 }, |
255 }) | 248 }) |
256 }) | 249 }) |
257 | 250 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 366 |
374 job { | 367 job { |
375 id: "noop-job-3" | 368 id: "noop-job-3" |
376 schedule: "*/10 * * * * * *" | 369 schedule: "*/10 * * * * * *" |
377 disabled: true | 370 disabled: true |
378 | 371 |
379 noop: {} | 372 noop: {} |
380 } | 373 } |
381 | 374 |
382 job { | 375 job { |
383 id: "missing-acls" | |
384 schedule: "*/5 * * * * * *" | |
385 | |
386 noop: {} | |
387 } | |
388 | |
389 job { | |
390 id: "urlfetch-job-1" | 376 id: "urlfetch-job-1" |
391 schedule: "*/10 * * * * * *" | 377 schedule: "*/10 * * * * * *" |
392 acl_sets: "public" | 378 acl_sets: "public" |
393 acls { | 379 acls { |
394 role: OWNER | 380 role: OWNER |
395 granted_to: "group:debuggers" | 381 granted_to: "group:debuggers" |
396 } | 382 } |
397 | 383 |
398 url_fetch: { | 384 url_fetch: { |
399 url: "https://example.com" | 385 url: "https://example.com" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 "projects/project1": { | 420 "projects/project1": { |
435 "scheduler.cfg": project1Cfg, | 421 "scheduler.cfg": project1Cfg, |
436 }, | 422 }, |
437 "projects/project2": { | 423 "projects/project2": { |
438 "scheduler.cfg": project2Cfg, | 424 "scheduler.cfg": project2Cfg, |
439 }, | 425 }, |
440 "projects/broken": { | 426 "projects/broken": { |
441 "scheduler.cfg": "broken!!!!111", | 427 "scheduler.cfg": "broken!!!!111", |
442 }, | 428 }, |
443 } | 429 } |
OLD | NEW |