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

Side by Side Diff: logdog/appengine/coordinator/coordinatorTest/logStream.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 coordinatorTest 5 package coordinatorTest
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "fmt" 9 "fmt"
10 "time" 10 "time"
11 11
12 "github.com/golang/protobuf/proto" 12 "github.com/golang/protobuf/proto"
13 ds "github.com/luci/gae/service/datastore" 13 ds "github.com/luci/gae/service/datastore"
14 "github.com/luci/luci-go/common/clock" 14 "github.com/luci/luci-go/common/clock"
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/logpb" 16 "github.com/luci/luci-go/logdog/api/logpb"
18 "github.com/luci/luci-go/logdog/appengine/coordinator" 17 "github.com/luci/luci-go/logdog/appengine/coordinator"
19 "github.com/luci/luci-go/logdog/common/types" 18 "github.com/luci/luci-go/logdog/common/types"
19 "github.com/luci/luci-go/luci_config/common/cfgtypes"
20 "golang.org/x/net/context" 20 "golang.org/x/net/context"
21 ) 21 )
22 22
23 // TestSecret returns a testing types.StreamPrefix. 23 // TestSecret returns a testing types.StreamPrefix.
24 func TestSecret() types.PrefixSecret { 24 func TestSecret() types.PrefixSecret {
25 return types.PrefixSecret(bytes.Repeat([]byte{0x6F}, types.PrefixSecretL ength)) 25 return types.PrefixSecret(bytes.Repeat([]byte{0x6F}, types.PrefixSecretL ength))
26 } 26 }
27 27
28 // TestStream returns a testing stream. 28 // TestStream returns a testing stream.
29 type TestStream struct { 29 type TestStream struct {
30 // Project is the project name for this stream. 30 // Project is the project name for this stream.
31 » Project config.ProjectName 31 » Project cfgtypes.ProjectName
32 // Path is the path of this stream. 32 // Path is the path of this stream.
33 Path types.StreamPath 33 Path types.StreamPath
34 34
35 // Desc is the log stream descriptor. 35 // Desc is the log stream descriptor.
36 Desc *logpb.LogStreamDescriptor 36 Desc *logpb.LogStreamDescriptor
37 37
38 // Prefix is the Coordinator LogPrefix entity. 38 // Prefix is the Coordinator LogPrefix entity.
39 Prefix *coordinator.LogPrefix 39 Prefix *coordinator.LogPrefix
40 // Prefix is the Coordinator LogStreamState entity. 40 // Prefix is the Coordinator LogStreamState entity.
41 State *coordinator.LogStreamState 41 State *coordinator.LogStreamState
42 // Prefix is the Coordinator LogStream entity. 42 // Prefix is the Coordinator LogStream entity.
43 Stream *coordinator.LogStream 43 Stream *coordinator.LogStream
44 } 44 }
45 45
46 // MakeStream builds a new TestStream with the supplied parameters. 46 // MakeStream builds a new TestStream with the supplied parameters.
47 func MakeStream(c context.Context, project config.ProjectName, path types.Stream Path) *TestStream { 47 func MakeStream(c context.Context, project cfgtypes.ProjectName, path types.Stre amPath) *TestStream {
48 prefix, name := path.Split() 48 prefix, name := path.Split()
49 49
50 now := clock.Now(c).UTC() 50 now := clock.Now(c).UTC()
51 secret := TestSecret() 51 secret := TestSecret()
52 52
53 ts := TestStream{ 53 ts := TestStream{
54 Project: project, 54 Project: project,
55 Prefix: &coordinator.LogPrefix{ 55 Prefix: &coordinator.LogPrefix{
56 ID: "", // Filled in by Reload. 56 ID: "", // Filled in by Reload.
57 Created: ds.RoundTime(now), 57 Created: ds.RoundTime(now),
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 168 }
169 } 169 }
170 return &le 170 return &le
171 } 171 }
172 172
173 // WithProjectNamespace runs f in proj's namespace, bypassing authentication 173 // WithProjectNamespace runs f in proj's namespace, bypassing authentication
174 // checks. 174 // checks.
175 func (ts *TestStream) WithProjectNamespace(c context.Context, f func(context.Con text)) { 175 func (ts *TestStream) WithProjectNamespace(c context.Context, f func(context.Con text)) {
176 WithProjectNamespace(c, ts.Project, f) 176 WithProjectNamespace(c, ts.Project, f)
177 } 177 }
OLDNEW
« no previous file with comments | « logdog/appengine/coordinator/coordinatorTest/context.go ('k') | logdog/appengine/coordinator/coordinatorTest/service.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698