| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 collector | 5 package collector |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "bytes" | 8 "bytes" |
| 9 "fmt" | 9 "fmt" |
| 10 "sync/atomic" | 10 "sync/atomic" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 So(errors.IsTransient(err), ShouldBeFals
e) | 151 So(errors.IsTransient(err), ShouldBeFals
e) |
| 152 So(tcc, shouldNotHaveRegisteredStream, "
foo/+/bar") | 152 So(tcc, shouldNotHaveRegisteredStream, "
foo/+/bar") |
| 153 }) | 153 }) |
| 154 | 154 |
| 155 Convey(`Will drop messages with mismatching secr
ets.`, func() { | 155 Convey(`Will drop messages with mismatching secr
ets.`, func() { |
| 156 bb.addStreamEntries("foo/+/bar", -1, 0,
1, 2) | 156 bb.addStreamEntries("foo/+/bar", -1, 0,
1, 2) |
| 157 So(coll.Process(c, bb.bundle()), ShouldB
eNil) | 157 So(coll.Process(c, bb.bundle()), ShouldB
eNil) |
| 158 | 158 |
| 159 // Push another bundle with a different
secret. | 159 // Push another bundle with a different
secret. |
| 160 be := bb.genBundleEntry("foo/+/bar", 4,
3, 4) | 160 be := bb.genBundleEntry("foo/+/bar", 4,
3, 4) |
| 161 » » » » » be.Secret = bytes.Repeat([]byte{0xAA}, t
ypes.StreamSecretLength) | 161 » » » » » be.Secret = bytes.Repeat([]byte{0xAA}, t
ypes.PrefixSecretLength) |
| 162 be.TerminalIndex = 1337 | 162 be.TerminalIndex = 1337 |
| 163 bb.addBundleEntry(be) | 163 bb.addBundleEntry(be) |
| 164 bb.addFullStream("foo/+/baz", 3) | 164 bb.addFullStream("foo/+/baz", 3) |
| 165 So(coll.Process(c, bb.bundle()), ShouldB
eNil) | 165 So(coll.Process(c, bb.bundle()), ShouldB
eNil) |
| 166 | 166 |
| 167 So(tcc, shouldHaveRegisteredStream, "foo
/+/bar", -1) | 167 So(tcc, shouldHaveRegisteredStream, "foo
/+/bar", -1) |
| 168 So(st, shouldHaveStoredStream, "foo/+/ba
r", indexRange{0, 2}) | 168 So(st, shouldHaveStoredStream, "foo/+/ba
r", indexRange{0, 2}) |
| 169 | 169 |
| 170 So(tcc, shouldHaveRegisteredStream, "foo
/+/baz", 2) | 170 So(tcc, shouldHaveRegisteredStream, "foo
/+/baz", 2) |
| 171 So(st, shouldHaveStoredStream, "foo/+/ba
z", indexRange{0, 2}) | 171 So(st, shouldHaveStoredStream, "foo/+/ba
z", indexRange{0, 2}) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 }) | 235 }) |
| 236 bb.addBundleEntry(be) | 236 bb.addBundleEntry(be) |
| 237 So(coll.Process(c, bb.bundle()), ShouldE
rrLike, "invalid log entry") | 237 So(coll.Process(c, bb.bundle()), ShouldE
rrLike, "invalid log entry") |
| 238 | 238 |
| 239 So(tcc, shouldNotHaveRegisteredStream, "
foo/+/bar") | 239 So(tcc, shouldNotHaveRegisteredStream, "
foo/+/bar") |
| 240 }) | 240 }) |
| 241 }) | 241 }) |
| 242 } | 242 } |
| 243 }) | 243 }) |
| 244 } | 244 } |
| OLD | NEW |