| 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 buildbucket | 5 package buildbucket |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "encoding/json" | 8 "encoding/json" |
| 9 "flag" | 9 "flag" |
| 10 "fmt" | 10 "fmt" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 testCases := []struct{ bucket, builder string }{ | 31 testCases := []struct{ bucket, builder string }{ |
| 32 {"master.tryserver.infra", "InfraPresubmit"}, | 32 {"master.tryserver.infra", "InfraPresubmit"}, |
| 33 {"master.tryserver.infra", "InfraPresubmit.Swarming"}, | 33 {"master.tryserver.infra", "InfraPresubmit.Swarming"}, |
| 34 } | 34 } |
| 35 | 35 |
| 36 Convey("Builder", t, func() { | 36 Convey("Builder", t, func() { |
| 37 c := memory.UseWithAppID(context.Background(), "luci-milo-dev") | 37 c := memory.UseWithAppID(context.Background(), "luci-milo-dev") |
| 38 c, _ = testclock.UseTime(c, testclock.TestRecentTimeUTC) | 38 c, _ = testclock.UseTime(c, testclock.TestRecentTimeUTC) |
| 39 c = testconfig.WithCommonClient(c, memcfg.New(bktConfigFull)) | 39 c = testconfig.WithCommonClient(c, memcfg.New(bktConfigFull)) |
| 40 // Update the service config so that the settings are loaded. | 40 // Update the service config so that the settings are loaded. |
| 41 » » err := common.UpdateServiceConfig(c) | 41 » » _, err := common.UpdateServiceConfig(c) |
| 42 So(err, ShouldBeNil) | 42 So(err, ShouldBeNil) |
| 43 | 43 |
| 44 for _, tc := range testCases { | 44 for _, tc := range testCases { |
| 45 tc := tc | 45 tc := tc |
| 46 Convey(fmt.Sprintf("%s:%s", tc.bucket, tc.builder), func
() { | 46 Convey(fmt.Sprintf("%s:%s", tc.bucket, tc.builder), func
() { |
| 47 expectationFilePath := filepath.Join("expectatio
ns", tc.bucket, tc.builder+".json") | 47 expectationFilePath := filepath.Join("expectatio
ns", tc.bucket, tc.builder+".json") |
| 48 err := os.MkdirAll(filepath.Dir(expectationFileP
ath), 0777) | 48 err := os.MkdirAll(filepath.Dir(expectationFileP
ath), 0777) |
| 49 So(err, ShouldBeNil) | 49 So(err, ShouldBeNil) |
| 50 | 50 |
| 51 actual, err := builderImpl(c, | 51 actual, err := builderImpl(c, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 67 So(string(actualJSON), ShouldEqual, stri
ng(expectedJSON)) | 67 So(string(actualJSON), ShouldEqual, stri
ng(expectedJSON)) |
| 68 } | 68 } |
| 69 }) | 69 }) |
| 70 } | 70 } |
| 71 }) | 71 }) |
| 72 } | 72 } |
| 73 | 73 |
| 74 var bktConfig = ` | 74 var bktConfig = ` |
| 75 buildbucket: { | 75 buildbucket: { |
| 76 host: "debug" | 76 host: "debug" |
| 77 project: "debug" |
| 77 } | 78 } |
| 78 ` | 79 ` |
| 79 | 80 |
| 80 var bktConfigFull = map[string]memcfg.ConfigSet{ | 81 var bktConfigFull = map[string]memcfg.ConfigSet{ |
| 81 "services/luci-milo-dev": { | 82 "services/luci-milo-dev": { |
| 82 "settings.cfg": bktConfig, | 83 "settings.cfg": bktConfig, |
| 83 }, | 84 }, |
| 84 } | 85 } |
| OLD | NEW |