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

Side by Side Diff: appengine/logdog/coordinator/coordinatorTest/context.go

Issue 1971623002: LogDog: Enable Coordinator to load project configs (Closed) Base URL: https://github.com/luci/luci-go@logdog-project-config
Patch Set: rebase (auto) Created 4 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package coordinatorTest 5 package coordinatorTest
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 9
10 "github.com/golang/protobuf/proto" 10 "github.com/golang/protobuf/proto"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 e.Clock = clock.Get(c).(testclock.TestClock) 176 e.Clock = clock.Get(c).(testclock.TestClock)
177 177
178 // Install GAE config service settings. 178 // Install GAE config service settings.
179 c = settings.Use(c, settings.New(&settings.MemoryStorage{})) 179 c = settings.Use(c, settings.New(&settings.MemoryStorage{}))
180 180
181 // Setup luci-config configuration. 181 // Setup luci-config configuration.
182 c = memory.Use(c, e.Config) 182 c = memory.Use(c, e.Config)
183 e.ConfigIface = luciConfig.Get(c) 183 e.ConfigIface = luciConfig.Get(c)
184 184
185 // luci-config: Projects. 185 // luci-config: Projects.
186 » addProjectConfig := func(name luciConfig.ProjectName, localName string, access ...string) { 186 » addProjectConfig := func(proj luciConfig.ProjectName, localName string, access ...string) {
187 » » configSet, configPath := config.ProjectConfigPath(c, proj)
188
187 var cfg configProto.ProjectCfg 189 var cfg configProto.ProjectCfg
188 » » e.modTextProtobuf(fmt.Sprintf("projects/%s", name), "project.cfg ", &cfg, func() { 190 » » e.modTextProtobuf(configSet, configPath, &cfg, func() {
189 cfg.Name = &localName 191 cfg.Name = &localName
190 cfg.Access = access 192 cfg.Access = access
191 }) 193 })
192 } 194 }
193 addProjectConfig("proj-foo", "Foo Project", "group:all") 195 addProjectConfig("proj-foo", "Foo Project", "group:all")
194 addProjectConfig("proj-bar", "Bar Project", "group:all") 196 addProjectConfig("proj-bar", "Bar Project", "group:all")
195 addProjectConfig("proj-baz", "Baz Project", "group:all") 197 addProjectConfig("proj-baz", "Baz Project", "group:all")
196 addProjectConfig("proj-qux", "Qux Project", "group:all") 198 addProjectConfig("proj-qux", "Qux Project", "group:all")
197 addProjectConfig("proj-exclusive", "Exclusive Project", "group:auth") 199 addProjectConfig("proj-exclusive", "Exclusive Project", "group:auth")
198 200
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 237 }
236 238
237 // WithProjectNamespace runs f in proj's namespace, bypassing authentication 239 // WithProjectNamespace runs f in proj's namespace, bypassing authentication
238 // checks. 240 // checks.
239 func WithProjectNamespace(c context.Context, proj luciConfig.ProjectName, f func (context.Context)) { 241 func WithProjectNamespace(c context.Context, proj luciConfig.ProjectName, f func (context.Context)) {
240 if err := coordinator.WithProjectNamespaceNoAuth(&c, proj); err != nil { 242 if err := coordinator.WithProjectNamespaceNoAuth(&c, proj); err != nil {
241 panic(err) 243 panic(err)
242 } 244 }
243 f(c) 245 f(c)
244 } 246 }
OLDNEW
« no previous file with comments | « appengine/logdog/coordinator/config/projects.go ('k') | appengine/logdog/coordinator/coordinatorTest/service.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698