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

Side by Side Diff: milo/appengine/buildbot/pubsub_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
« no previous file with comments | « luci_config/appengine/gaeconfig/settings.go ('k') | milo/appengine/logdog/http.go » ('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. 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 "bytes" 8 "bytes"
9 "compress/zlib" 9 "compress/zlib"
10 "encoding/base64" 10 "encoding/base64"
11 "encoding/json" 11 "encoding/json"
12 "io" 12 "io"
13 "io/ioutil" 13 "io/ioutil"
14 "math/rand" 14 "math/rand"
15 "net/http" 15 "net/http"
16 "net/http/httptest" 16 "net/http/httptest"
17 "testing" 17 "testing"
18 "time" 18 "time"
19 19
20 "github.com/luci/gae/impl/memory" 20 "github.com/luci/gae/impl/memory"
21 ds "github.com/luci/gae/service/datastore" 21 ds "github.com/luci/gae/service/datastore"
22 "github.com/luci/luci-go/common/clock/testclock" 22 "github.com/luci/luci-go/common/clock/testclock"
23 lucicfg "github.com/luci/luci-go/common/config"
24 memcfg "github.com/luci/luci-go/common/config/impl/memory" 23 memcfg "github.com/luci/luci-go/common/config/impl/memory"
25 "github.com/luci/luci-go/common/logging/gologger" 24 "github.com/luci/luci-go/common/logging/gologger"
25 "github.com/luci/luci-go/luci_config/server/cfgclient/backend/testconfig "
26 "github.com/luci/luci-go/milo/appengine/settings" 26 "github.com/luci/luci-go/milo/appengine/settings"
27 "github.com/luci/luci-go/server/auth" 27 "github.com/luci/luci-go/server/auth"
28 "github.com/luci/luci-go/server/auth/authtest" 28 "github.com/luci/luci-go/server/auth/authtest"
29 "github.com/luci/luci-go/server/router" 29 "github.com/luci/luci-go/server/router"
30 30
31 "github.com/julienschmidt/httprouter" 31 "github.com/julienschmidt/httprouter"
32 "golang.org/x/net/context" 32 "golang.org/x/net/context"
33 33
34 . "github.com/luci/luci-go/common/testing/assertions" 34 . "github.com/luci/luci-go/common/testing/assertions"
35 . "github.com/smartystreets/goconvey/convey" 35 . "github.com/smartystreets/goconvey/convey"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 } 425 }
426 p := httprouter.Params{} 426 p := httprouter.Params{}
427 PubSubHandler(&router.Context{ 427 PubSubHandler(&router.Context{
428 Context: c, 428 Context: c,
429 Writer: h, 429 Writer: h,
430 Request: r, 430 Request: r,
431 Params: p, 431 Params: p,
432 }) 432 })
433 So(h.Code, ShouldEqual, 200) 433 So(h.Code, ShouldEqual, 200)
434 Convey("And stores correctly", func() { 434 Convey("And stores correctly", func() {
435 » » » » c = lucicfg.SetImplementation(c, memcfg.New(aclC onfgs)) 435 » » » » c = testconfig.WithCommonClient(c, memcfg.New(ac lConfgs))
436
436 err := settings.Update(c) 437 err := settings.Update(c)
437 So(err, ShouldBeNil) 438 So(err, ShouldBeNil)
438 c = auth.WithState(c, &authtest.FakeState{ 439 c = auth.WithState(c, &authtest.FakeState{
439 Identity: "user:alicebob@google.co m", 440 Identity: "user:alicebob@google.co m",
440 IdentityGroups: []string{"google.com", " all"}, 441 IdentityGroups: []string{"google.com", " all"},
441 }) 442 })
442 loadB := &buildbotBuild{ 443 loadB := &buildbotBuild{
443 Master: "Fake Master", 444 Master: "Fake Master",
444 Buildername: "Fake buildername", 445 Buildername: "Fake buildername",
445 Number: 1234, 446 Number: 1234,
(...skipping 21 matching lines...) Expand all
467 var secretProjectCfg = ` 468 var secretProjectCfg = `
468 ID: "buildbot-internal" 469 ID: "buildbot-internal"
469 Readers: "google.com" 470 Readers: "google.com"
470 ` 471 `
471 472
472 var aclConfgs = map[string]memcfg.ConfigSet{ 473 var aclConfgs = map[string]memcfg.ConfigSet{
473 "projects/buildbot-internal.git": { 474 "projects/buildbot-internal.git": {
474 "luci-milo.cfg": secretProjectCfg, 475 "luci-milo.cfg": secretProjectCfg,
475 }, 476 },
476 } 477 }
OLDNEW
« no previous file with comments | « luci_config/appengine/gaeconfig/settings.go ('k') | milo/appengine/logdog/http.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698