| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package buildbot | 5 package buildbot |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "encoding/json" | 8 "encoding/json" |
| 9 "flag" | 9 "flag" |
| 10 "fmt" | 10 "fmt" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 refBuild, err := load(expectedFilename[0].(string)) | 38 refBuild, err := load(expectedFilename[0].(string)) |
| 39 if err != nil { | 39 if err != nil { |
| 40 return fmt.Sprintf("Could not load %s: %s", expectedFilename[0],
err.Error()) | 40 return fmt.Sprintf("Could not load %s: %s", expectedFilename[0],
err.Error()) |
| 41 } | 41 } |
| 42 actualBuild, err := json.MarshalIndent(actualContents, "", " ") | 42 actualBuild, err := json.MarshalIndent(actualContents, "", " ") |
| 43 return ShouldEqual(string(actualBuild), string(refBuild)) | 43 return ShouldEqual(string(actualBuild), string(refBuild)) |
| 44 | 44 |
| 45 } | 45 } |
| 46 | 46 |
| 47 func TestBuild(t *testing.T) { | 47 func TestBuild(t *testing.T) { |
| 48 » c := memory.Use(context.Background()) | 48 » c := memory.UseWithAppID(context.Background(), "dev~luci-milo") |
| 49 c, _ = testclock.UseTime(c, testclock.TestTimeUTC) | 49 c, _ = testclock.UseTime(c, testclock.TestTimeUTC) |
| 50 | 50 |
| 51 if *generate { | 51 if *generate { |
| 52 for _, tc := range testCases { | 52 for _, tc := range testCases { |
| 53 fmt.Printf("Generating expectations for %s/%s\n", tc.bui
lder, tc.build) | 53 fmt.Printf("Generating expectations for %s/%s\n", tc.bui
lder, tc.build) |
| 54 build, err := build(c, "debug", tc.builder, tc.build) | 54 build, err := build(c, "debug", tc.builder, tc.build) |
| 55 if err != nil { | 55 if err != nil { |
| 56 panic(fmt.Errorf("Could not run build() for %s/%
s: %s", tc.builder, tc.build, err)) | 56 panic(fmt.Errorf("Could not run build() for %s/%
s: %s", tc.builder, tc.build, err)) |
| 57 } | 57 } |
| 58 buildJSON, err := json.MarshalIndent(build, "", " ") | 58 buildJSON, err := json.MarshalIndent(build, "", " ") |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 Number: 1, | 92 Number: 1, |
| 93 Internal: true, | 93 Internal: true, |
| 94 }) | 94 }) |
| 95 _, err := getBuild(c, "fake", "fake", 1) | 95 _, err := getBuild(c, "fake", "fake", 1) |
| 96 So(err, ShouldResemble, errNotAuth) | 96 So(err, ShouldResemble, errNotAuth) |
| 97 }) | 97 }) |
| 98 }) | 98 }) |
| 99 } | 99 } |
| 100 | 100 |
| 101 var internalConfig = ` | 101 var internalConfig = ` |
| 102 name: "buildbot-internal" | 102 buildbot: { |
| 103 access: "group:googlers" | 103 » internal_reader: "googlers" |
| 104 } |
| 104 ` | 105 ` |
| 105 | 106 |
| 106 var bbAclConfigs = map[string]memcfg.ConfigSet{ | 107 var bbAclConfigs = map[string]memcfg.ConfigSet{ |
| 107 » "projects/chrome": { | 108 » "services/luci-milo": { |
| 108 » » "project.cfg": internalConfig, | 109 » » "settings.cfg": internalConfig, |
| 109 }, | 110 }, |
| 110 } | 111 } |
| OLD | NEW |