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

Side by Side Diff: logdog/appengine/coordinator/endpoints/services/registerStream_test.go

Issue 2626433004: Move "common/config" common types into cfgtypes. (Closed)
Patch Set: 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 services 5 package services
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 "fmt" 9 "fmt"
10 "testing" 10 "testing"
11 "time" 11 "time"
12 12
13 "github.com/luci/gae/filter/featureBreaker" 13 "github.com/luci/gae/filter/featureBreaker"
14 ds "github.com/luci/gae/service/datastore" 14 ds "github.com/luci/gae/service/datastore"
15 "github.com/luci/luci-go/common/config"
16 "github.com/luci/luci-go/common/proto/google" 15 "github.com/luci/luci-go/common/proto/google"
17 "github.com/luci/luci-go/logdog/api/config/svcconfig" 16 "github.com/luci/luci-go/logdog/api/config/svcconfig"
18 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/services/v1" 17 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/services/v1"
19 "github.com/luci/luci-go/logdog/api/logpb" 18 "github.com/luci/luci-go/logdog/api/logpb"
20 "github.com/luci/luci-go/logdog/appengine/coordinator" 19 "github.com/luci/luci-go/logdog/appengine/coordinator"
21 ct "github.com/luci/luci-go/logdog/appengine/coordinator/coordinatorTest " 20 ct "github.com/luci/luci-go/logdog/appengine/coordinator/coordinatorTest "
22 "github.com/luci/luci-go/logdog/appengine/coordinator/hierarchy" 21 "github.com/luci/luci-go/logdog/appengine/coordinator/hierarchy"
23 "github.com/luci/luci-go/logdog/common/types" 22 "github.com/luci/luci-go/logdog/common/types"
23 "github.com/luci/luci-go/luci_config/common/cfgtypes"
24 "golang.org/x/net/context" 24 "golang.org/x/net/context"
25 25
26 . "github.com/luci/luci-go/common/testing/assertions" 26 . "github.com/luci/luci-go/common/testing/assertions"
27 . "github.com/smartystreets/goconvey/convey" 27 . "github.com/smartystreets/goconvey/convey"
28 ) 28 )
29 29
30 func TestRegisterStream(t *testing.T) { 30 func TestRegisterStream(t *testing.T) {
31 t.Parallel() 31 t.Parallel()
32 32
33 Convey(`With a testing configuration`, t, func() { 33 Convey(`With a testing configuration`, t, func() {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 }) 316 })
317 env.ModProjectConfig(c, "proj-foo", func(pcfg *svcconfig.ProjectConfig) { 317 env.ModProjectConfig(c, "proj-foo", func(pcfg *svcconfig.ProjectConfig) {
318 pcfg.MaxStreamAge = google.NewDuration(time.Hour) 318 pcfg.MaxStreamAge = google.NewDuration(time.Hour)
319 }) 319 })
320 320
321 // By default, the testing user is a service. 321 // By default, the testing user is a service.
322 env.JoinGroup("services") 322 env.JoinGroup("services")
323 323
324 const ( 324 const (
325 prefix = types.StreamName("testing") 325 prefix = types.StreamName("testing")
326 » » project = config.ProjectName("proj-foo") 326 » » project = cfgtypes.ProjectName("proj-foo")
327 ) 327 )
328 328
329 tls := ct.MakeStream(c, project, prefix.Join(types.StreamName(fmt.Sprint f("foo/bar")))) 329 tls := ct.MakeStream(c, project, prefix.Join(types.StreamName(fmt.Sprint f("foo/bar"))))
330 tls.WithProjectNamespace(c, func(c context.Context) { 330 tls.WithProjectNamespace(c, func(c context.Context) {
331 if err := ds.Put(c, tls.Prefix); err != nil { 331 if err := ds.Put(c, tls.Prefix); err != nil {
332 b.Fatalf("failed to register prefix: %v", err) 332 b.Fatalf("failed to register prefix: %v", err)
333 } 333 }
334 }) 334 })
335 335
336 svr := New() 336 svr := New()
(...skipping 10 matching lines...) Expand all
347 Desc: tls.DescBytes(), 347 Desc: tls.DescBytes(),
348 TerminalIndex: -1, 348 TerminalIndex: -1,
349 } 349 }
350 350
351 _, err := svr.RegisterStream(c, &req) 351 _, err := svr.RegisterStream(c, &req)
352 if err != nil { 352 if err != nil {
353 b.Fatalf("failed to get OK response (%s)", err) 353 b.Fatalf("failed to get OK response (%s)", err)
354 } 354 }
355 } 355 }
356 } 356 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698