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

Side by Side Diff: client/internal/logdog/butler/butler_test.go

Issue 1975683002: LogDog: Implement prefix registration in Butler. (Closed) Base URL: https://github.com/luci/luci-go@logdog-butler-register-collector
Patch Set: Rebarse Created 4 years, 6 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 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 butler 5 package butler
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "errors" 9 "errors"
10 "fmt" 10 "fmt"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 t.Parallel() 224 t.Parallel()
225 225
226 Convey(`A Config instance`, t, func() { 226 Convey(`A Config instance`, t, func() {
227 to := testOutput{ 227 to := testOutput{
228 maxSize: 1024, 228 maxSize: 1024,
229 } 229 }
230 conf := Config{ 230 conf := Config{
231 Output: &to, 231 Output: &to,
232 Prefix: "unit/test", 232 Prefix: "unit/test",
233 Project: "test-project", 233 Project: "test-project",
234 Secret: types.PrefixSecret(bytes.Repeat([]byte{0x55}, t ypes.PrefixSecretLength)),
235 } 234 }
236 235
237 Convey(`Will validate.`, func() { 236 Convey(`Will validate.`, func() {
238 So(conf.Validate(), ShouldBeNil) 237 So(conf.Validate(), ShouldBeNil)
239 }) 238 })
240 239
241 Convey(`Will not validate with a nil Output.`, func() { 240 Convey(`Will not validate with a nil Output.`, func() {
242 conf.Output = nil 241 conf.Output = nil
243 So(conf.Validate(), ShouldErrLike, "an Output must be su pplied") 242 So(conf.Validate(), ShouldErrLike, "an Output must be su pplied")
244 }) 243 })
(...skipping 30 matching lines...) Expand all
275 to := testOutput{ 274 to := testOutput{
276 maxSize: 1024, 275 maxSize: 1024,
277 } 276 }
278 277
279 conf := Config{ 278 conf := Config{
280 Output: &to, 279 Output: &to,
281 OutputWorkers: 1, 280 OutputWorkers: 1,
282 BufferLogs: false, 281 BufferLogs: false,
283 Prefix: "unit/test", 282 Prefix: "unit/test",
284 Project: "test-project", 283 Project: "test-project",
285 Secret: types.PrefixSecret(bytes.Repeat([]byte{0x 55}, types.PrefixSecretLength)),
286 TeeStdout: &teeStdout, 284 TeeStdout: &teeStdout,
287 TeeStderr: &teeStderr, 285 TeeStderr: &teeStderr,
288 } 286 }
289 287
290 Convey(`Will error if an invalid Config is passed.`, func() { 288 Convey(`Will error if an invalid Config is passed.`, func() {
291 conf.Output = nil 289 conf.Output = nil
292 So(conf.Validate(), ShouldNotBeNil) 290 So(conf.Validate(), ShouldNotBeNil)
293 291
294 _, err := New(c, conf) 292 _, err := New(c, conf)
295 So(err, ShouldNotBeNil) 293 So(err, ShouldNotBeNil)
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 tss.onNext = func() { 529 tss.onNext = func() {
532 panic("test panic") 530 panic("test panic")
533 } 531 }
534 532
535 b := mkb(c, conf) 533 b := mkb(c, conf)
536 b.AddStreamServer(tss) 534 b.AddStreamServer(tss)
537 So(b.Wait(), ShouldErrLike, "test panic") 535 So(b.Wait(), ShouldErrLike, "test panic")
538 }) 536 })
539 }) 537 })
540 } 538 }
OLDNEW
« no previous file with comments | « client/internal/logdog/butler/butler.go ('k') | client/internal/logdog/butler/output/pubsub/pubsubOutput.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698