| OLD | NEW |
| 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 "bytes" | 8 "bytes" |
| 9 "fmt" | 9 "fmt" |
| 10 "time" | 10 "time" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 config.ProjectName, path types.Stream
Path) *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), |
| 58 » » » Prefix: "", // Filled in by Reload. | 58 » » » Prefix: "", // Filled in by Reload. |
| 59 » » » Source: []string{"test suite"}, | 59 » » » Source: []string{"test suite"}, |
| 60 » » » Secret: secret, | 60 » » » Expiration: ds.RoundTime(now.Add(24 * time.Hour)), |
| 61 » » » Secret: secret, |
| 61 }, | 62 }, |
| 62 Desc: &logpb.LogStreamDescriptor{ | 63 Desc: &logpb.LogStreamDescriptor{ |
| 63 Prefix: string(prefix), | 64 Prefix: string(prefix), |
| 64 Name: string(name), | 65 Name: string(name), |
| 65 StreamType: logpb.StreamType_TEXT, | 66 StreamType: logpb.StreamType_TEXT, |
| 66 ContentType: "application/text", | 67 ContentType: "application/text", |
| 67 Timestamp: google.NewTimestamp(now), | 68 Timestamp: google.NewTimestamp(now), |
| 68 }, | 69 }, |
| 69 State: &coordinator.LogStreamState{ | 70 State: &coordinator.LogStreamState{ |
| 70 Parent: nil, // Filled in by Reload. | 71 Parent: nil, // Filled in by Reload. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 168 } |
| 168 } | 169 } |
| 169 return &le | 170 return &le |
| 170 } | 171 } |
| 171 | 172 |
| 172 // WithProjectNamespace runs f in proj's namespace, bypassing authentication | 173 // WithProjectNamespace runs f in proj's namespace, bypassing authentication |
| 173 // checks. | 174 // checks. |
| 174 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)) { |
| 175 WithProjectNamespace(c, ts.Project, f) | 176 WithProjectNamespace(c, ts.Project, f) |
| 176 } | 177 } |
| OLD | NEW |