| OLD | NEW |
| 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 butler | 5 package butler |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "bytes" | 8 "bytes" |
| 9 "errors" | 9 "errors" |
| 10 "fmt" | 10 "fmt" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 onNext func() | 186 onNext func() |
| 187 streamC chan *testStream | 187 streamC chan *testStream |
| 188 } | 188 } |
| 189 | 189 |
| 190 func newTestStreamServer() *testStreamServer { | 190 func newTestStreamServer() *testStreamServer { |
| 191 return &testStreamServer{ | 191 return &testStreamServer{ |
| 192 streamC: make(chan *testStream), | 192 streamC: make(chan *testStream), |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 | 195 |
| 196 func (tss *testStreamServer) Listen() error { | 196 func (tss *testStreamServer) Address() string { return "test" } |
| 197 » return tss.err | 197 |
| 198 } | 198 func (tss *testStreamServer) Listen() error { return tss.err } |
| 199 | 199 |
| 200 func (tss *testStreamServer) Next() (io.ReadCloser, *streamproto.Properties) { | 200 func (tss *testStreamServer) Next() (io.ReadCloser, *streamproto.Properties) { |
| 201 if tss.onNext != nil { | 201 if tss.onNext != nil { |
| 202 tss.onNext() | 202 tss.onNext() |
| 203 } | 203 } |
| 204 | 204 |
| 205 ts, ok := <-tss.streamC | 205 ts, ok := <-tss.streamC |
| 206 if !ok { | 206 if !ok { |
| 207 return nil, nil | 207 return nil, nil |
| 208 } | 208 } |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 tss.onNext = func() { | 598 tss.onNext = func() { |
| 599 panic("test panic") | 599 panic("test panic") |
| 600 } | 600 } |
| 601 | 601 |
| 602 b := mkb(c, conf) | 602 b := mkb(c, conf) |
| 603 b.AddStreamServer(tss) | 603 b.AddStreamServer(tss) |
| 604 So(b.Wait(), ShouldErrLike, "test panic") | 604 So(b.Wait(), ShouldErrLike, "test panic") |
| 605 }) | 605 }) |
| 606 }) | 606 }) |
| 607 } | 607 } |
| OLD | NEW |