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

Side by Side Diff: milo/common/config_test.go

Issue 2982183002: Milo: Store console defs as their own entities (Closed)
Patch Set: Rebase fixes and Working Created 3 years, 5 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 | « milo/common/config.go ('k') | milo/frontend/appengine/templates/pages/configs.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The LUCI Authors. 1 // Copyright 2016 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 So(rSettings, ShouldResemble, settings) 54 So(rSettings, ShouldResemble, settings)
55 So(settings.Buildbot.InternalReader, ShouldEqual , "googlers") 55 So(settings.Buildbot.InternalReader, ShouldEqual , "googlers")
56 }) 56 })
57 }) 57 })
58 58
59 Convey("Send update", func() { 59 Convey("Send update", func() {
60 c = testconfig.WithCommonClient(c, memcfg.New(mockedConf igs)) 60 c = testconfig.WithCommonClient(c, memcfg.New(mockedConf igs))
61 _, err := UpdateServiceConfig(c) 61 _, err := UpdateServiceConfig(c)
62 So(err, ShouldBeNil) 62 So(err, ShouldBeNil)
63 // Send update here 63 // Send update here
64 » » » err = UpdateProjectConfigs(c) 64 » » » So(UpdateConsoles(c), ShouldBeNil)
65 » » » So(err, ShouldBeNil)
66
67 » » » Convey("Check Project config updated", func() {
68 » » » » p, err := GetProject(c, "foo")
69 » » » » So(err, ShouldBeNil)
70 » » » » So(p.ID, ShouldEqual, "foo")
71 » » » })
72 65
73 Convey("Check Console config updated", func() { 66 Convey("Check Console config updated", func() {
74 cs, err := GetConsole(c, "foo", "default") 67 cs, err := GetConsole(c, "foo", "default")
75 So(err, ShouldBeNil) 68 So(err, ShouldBeNil)
76 » » » » So(cs.Name, ShouldEqual, "default") 69 » » » » So(cs.ID, ShouldEqual, "default")
77 So(cs.RepoURL, ShouldEqual, "https://chromium.go oglesource.com/foo/bar") 70 So(cs.RepoURL, ShouldEqual, "https://chromium.go oglesource.com/foo/bar")
78 }) 71 })
79 }) 72 })
80 }) 73 })
81 } 74 }
82 75
83 var fooCfg = ` 76 var fooCfg = `
84 ID: "foo" 77 ID: "foo"
85 Consoles: { 78 Consoles: {
86 » Name: "default" 79 » ID: "default"
87 RepoURL: "https://chromium.googlesource.com/foo/bar" 80 RepoURL: "https://chromium.googlesource.com/foo/bar"
88 » Branch: "master" 81 » Ref: "master"
89 Builders: { 82 Builders: {
90 Name: "buildbucket/luci.foo.something/bar" 83 Name: "buildbucket/luci.foo.something/bar"
91 Category: "main|something" 84 Category: "main|something"
92 ShortName: "s" 85 ShortName: "s"
93 } 86 }
94 Builders: { 87 Builders: {
95 Name: "buildbucket/luci.foo.other/baz" 88 Name: "buildbucket/luci.foo.other/baz"
96 Category: "main|other" 89 Category: "main|other"
97 ShortName: "o" 90 ShortName: "o"
98 } 91 }
99 } 92 }
100 ` 93 `
101 94
102 var settingsCfg = ` 95 var settingsCfg = `
103 buildbot: { 96 buildbot: {
104 internal_reader: "googlers" 97 internal_reader: "googlers"
105 } 98 }
106 ` 99 `
107 100
108 var mockedConfigs = map[string]memcfg.ConfigSet{ 101 var mockedConfigs = map[string]memcfg.ConfigSet{
109 "projects/foo": { 102 "projects/foo": {
110 "luci-milo.cfg": fooCfg, 103 "luci-milo.cfg": fooCfg,
111 }, 104 },
112 } 105 }
OLDNEW
« no previous file with comments | « milo/common/config.go ('k') | milo/frontend/appengine/templates/pages/configs.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698