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

Side by Side Diff: scheduler/appengine/catalog/catalog_test.go

Issue 2993793004: [scheduler]: ACLs phase 2 - warn if Job/Trigger don't have ACLs. (Closed)
Patch Set: Created 3 years, 4 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 | « scheduler/appengine/catalog/catalog.go ('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
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
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: "847cf9c217f7bad214805f3bea7a3 0799383940b", 211 » » » » » Revision: "ad93dac7f33309b6e5f3b53d6206d 1b9361f83db",
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: "847cf9c217f7bad214805f3bea7a3 0799383940b", 218 » » » » » Revision: "ad93dac7f33309b6e5f3b53d6206d 1b9361f83db",
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 {
223 JobID: "project1/urlfetch-job-1", 230 JobID: "project1/urlfetch-job-1",
224 Acls: acl.GrantsByRole{Readers: []st ring{"group:all"}, Owners: []string{"group:debuggers", "group:some-admins"}}, 231 Acls: acl.GrantsByRole{Readers: []st ring{"group:all"}, Owners: []string{"group:debuggers", "group:some-admins"}},
225 » » » » » Revision: "847cf9c217f7bad214805f3bea7a3 0799383940b", 232 » » » » » Revision: "ad93dac7f33309b6e5f3b53d6206d 1b9361f83db",
226 Schedule: "*/10 * * * * * *", 233 Schedule: "*/10 * * * * * *",
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}, 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},
228 }, 235 },
229 { 236 {
230 JobID: "project1/urlfetch-job-2", 237 JobID: "project1/urlfetch-job-2",
231 Acls: acl.GrantsByRole{Readers: []st ring{"group:all"}, Owners: []string{"group:some-admins"}}, 238 Acls: acl.GrantsByRole{Readers: []st ring{"group:all"}, Owners: []string{"group:some-admins"}},
232 » » » » » Revision: "847cf9c217f7bad214805f3bea7a3 0799383940b", 239 » » » » » Revision: "ad93dac7f33309b6e5f3b53d6206d 1b9361f83db",
233 Schedule: "*/10 * * * * * *", 240 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}, 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},
235 }, 242 },
236 }) 243 })
237 244
238 // Make sure URL fetch jobs are parsed correctly and ide ntically. 245 // Make sure URL fetch jobs are parsed correctly and ide ntically.
239 » » » newStyleDef := defs[2].Task 246 » » » newStyleDef := defs[3].Task
240 » » » oldStyleDef := defs[3].Task 247 » » » oldStyleDef := defs[4].Task
241 So(newStyleDef, ShouldResemble, oldStyleDef) 248 So(newStyleDef, ShouldResemble, oldStyleDef)
242 msg := messages.TaskDefWrapper{} 249 msg := messages.TaskDefWrapper{}
243 proto.Unmarshal(newStyleDef, &msg) 250 proto.Unmarshal(newStyleDef, &msg)
244 So(msg, ShouldResemble, messages.TaskDefWrapper{ 251 So(msg, ShouldResemble, messages.TaskDefWrapper{
245 UrlFetch: &messages.UrlFetchTask{ 252 UrlFetch: &messages.UrlFetchTask{
246 Url: "https://example.com", 253 Url: "https://example.com",
247 }, 254 },
248 }) 255 })
249 }) 256 })
250 257
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 373
367 job { 374 job {
368 id: "noop-job-3" 375 id: "noop-job-3"
369 schedule: "*/10 * * * * * *" 376 schedule: "*/10 * * * * * *"
370 disabled: true 377 disabled: true
371 378
372 noop: {} 379 noop: {}
373 } 380 }
374 381
375 job { 382 job {
383 id: "missing-acls"
384 schedule: "*/5 * * * * * *"
385
386 noop: {}
387 }
388
389 job {
376 id: "urlfetch-job-1" 390 id: "urlfetch-job-1"
377 schedule: "*/10 * * * * * *" 391 schedule: "*/10 * * * * * *"
378 acl_sets: "public" 392 acl_sets: "public"
379 acls { 393 acls {
380 role: OWNER 394 role: OWNER
381 granted_to: "group:debuggers" 395 granted_to: "group:debuggers"
382 } 396 }
383 397
384 url_fetch: { 398 url_fetch: {
385 url: "https://example.com" 399 url: "https://example.com"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 "projects/project1": { 434 "projects/project1": {
421 "scheduler.cfg": project1Cfg, 435 "scheduler.cfg": project1Cfg,
422 }, 436 },
423 "projects/project2": { 437 "projects/project2": {
424 "scheduler.cfg": project2Cfg, 438 "scheduler.cfg": project2Cfg,
425 }, 439 },
426 "projects/broken": { 440 "projects/broken": {
427 "scheduler.cfg": "broken!!!!111", 441 "scheduler.cfg": "broken!!!!111",
428 }, 442 },
429 } 443 }
OLDNEW
« no previous file with comments | « scheduler/appengine/catalog/catalog.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698