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

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

Issue 2575383002: Add server/cache support to gaeconfig. (Closed)
Patch Set: Un-collapse. Created 3 years, 11 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 LUCI Authors. All rights reserved. 1 // Copyright 2015 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 catalog 5 package catalog
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 "testing" 9 "testing"
10 10
11 "github.com/golang/protobuf/proto" 11 "github.com/golang/protobuf/proto"
12 "golang.org/x/net/context" 12 "golang.org/x/net/context"
13 "google.golang.org/api/pubsub/v1" 13 "google.golang.org/api/pubsub/v1"
14 14
15 "github.com/luci/luci-go/common/config"
16 memcfg "github.com/luci/luci-go/common/config/impl/memory" 15 memcfg "github.com/luci/luci-go/common/config/impl/memory"
16 "github.com/luci/luci-go/luci_config/server/cfgclient/backend/testconfig "
17 17
18 "github.com/luci/luci-go/scheduler/appengine/messages" 18 "github.com/luci/luci-go/scheduler/appengine/messages"
19 "github.com/luci/luci-go/scheduler/appengine/task" 19 "github.com/luci/luci-go/scheduler/appengine/task"
20 20
21 . "github.com/luci/luci-go/common/testing/assertions" 21 . "github.com/luci/luci-go/common/testing/assertions"
22 . "github.com/smartystreets/goconvey/convey" 22 . "github.com/smartystreets/goconvey/convey"
23 ) 23 )
24 24
25 func TestRegisterTaskManagerAndFriends(t *testing.T) { 25 func TestRegisterTaskManagerAndFriends(t *testing.T) {
26 Convey("RegisterTaskManager works", t, func() { 26 Convey("RegisterTaskManager works", t, func() {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 // Once registered, but not anymore. 167 // Once registered, but not anymore.
168 c = New("scheduler.cfg").(*catalog) 168 c = New("scheduler.cfg").(*catalog)
169 _, err = c.UnmarshalTask(blob) 169 _, err = c.UnmarshalTask(blob)
170 So(err, ShouldErrLike, "can't find a recognized task definition" ) 170 So(err, ShouldErrLike, "can't find a recognized task definition" )
171 }) 171 })
172 } 172 }
173 173
174 func TestConfigReading(t *testing.T) { 174 func TestConfigReading(t *testing.T) {
175 Convey("with mocked config", t, func() { 175 Convey("with mocked config", t, func() {
176 » » ctx := config.SetImplementation(context.Background(), memcfg.New (mockedConfigs)) 176 » » ctx := testconfig.WithCommonClient(context.Background(), memcfg. New(mockedConfigs))
177 cat := New("scheduler.cfg") 177 cat := New("scheduler.cfg")
178 cat.RegisterTaskManager(fakeTaskManager{ 178 cat.RegisterTaskManager(fakeTaskManager{
179 name: "noop", 179 name: "noop",
180 task: &messages.NoopTask{}, 180 task: &messages.NoopTask{},
181 }) 181 })
182 cat.RegisterTaskManager(fakeTaskManager{ 182 cat.RegisterTaskManager(fakeTaskManager{
183 name: "url_fetch", 183 name: "url_fetch",
184 task: &messages.UrlFetchTask{}, 184 task: &messages.UrlFetchTask{},
185 }) 185 })
186 186
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 "projects/project1": { 380 "projects/project1": {
381 "scheduler.cfg": project1Cfg, 381 "scheduler.cfg": project1Cfg,
382 }, 382 },
383 "projects/project2": { 383 "projects/project2": {
384 "scheduler.cfg": project2Cfg, 384 "scheduler.cfg": project2Cfg,
385 }, 385 },
386 "projects/broken": { 386 "projects/broken": {
387 "scheduler.cfg": "broken!!!!111", 387 "scheduler.cfg": "broken!!!!111",
388 }, 388 },
389 } 389 }
OLDNEW
« no previous file with comments | « scheduler/appengine/catalog/catalog.go ('k') | tokenserver/appengine/certconfig/rpc_import_ca_configs.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698