| 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 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 ls, err := coordinator.NewLogStream(string(desc.Path())) | 34 ls, err := coordinator.NewLogStream(string(desc.Path())) |
| 35 if err != nil { | 35 if err != nil { |
| 36 panic(err) | 36 panic(err) |
| 37 } | 37 } |
| 38 if err := ls.LoadDescriptor(desc); err != nil { | 38 if err := ls.LoadDescriptor(desc); err != nil { |
| 39 panic(err) | 39 panic(err) |
| 40 } | 40 } |
| 41 | 41 |
| 42 ls.ProtoVersion = logpb.Version | 42 ls.ProtoVersion = logpb.Version |
| 43 ls.Created = ds.RoundTime(clock.Now(c).UTC()) | 43 ls.Created = ds.RoundTime(clock.Now(c).UTC()) |
| 44 » ls.Secret = bytes.Repeat([]byte{0x6F}, types.StreamSecretLength) | 44 » ls.Secret = bytes.Repeat([]byte{0x6F}, types.PrefixSecretLength) |
| 45 ls.TerminalIndex = -1 | 45 ls.TerminalIndex = -1 |
| 46 return ls | 46 return ls |
| 47 } | 47 } |
| 48 | 48 |
| 49 // TestLogEntry generates a standard testing text logpb.LogEntry. | 49 // TestLogEntry generates a standard testing text logpb.LogEntry. |
| 50 func TestLogEntry(c context.Context, ls *coordinator.LogStream, i int) *logpb.Lo
gEntry { | 50 func TestLogEntry(c context.Context, ls *coordinator.LogStream, i int) *logpb.Lo
gEntry { |
| 51 return &logpb.LogEntry{ | 51 return &logpb.LogEntry{ |
| 52 TimeOffset: google.NewDuration(clock.Now(c).Sub(ls.Created)), | 52 TimeOffset: google.NewDuration(clock.Now(c).Sub(ls.Created)), |
| 53 StreamIndex: uint64(i), | 53 StreamIndex: uint64(i), |
| 54 | 54 |
| 55 Content: &logpb.LogEntry_Text{ | 55 Content: &logpb.LogEntry_Text{ |
| 56 &logpb.Text{ | 56 &logpb.Text{ |
| 57 Lines: []*logpb.Text_Line{ | 57 Lines: []*logpb.Text_Line{ |
| 58 { | 58 { |
| 59 Value: fmt.Sprintf("log entr
y #%d", i), | 59 Value: fmt.Sprintf("log entr
y #%d", i), |
| 60 Delimiter: "\n", | 60 Delimiter: "\n", |
| 61 }, | 61 }, |
| 62 }, | 62 }, |
| 63 }, | 63 }, |
| 64 }, | 64 }, |
| 65 } | 65 } |
| 66 } | 66 } |
| OLD | NEW |