Debian Codegraph @

m3/thriftudp/multitransport_test.go

raw symbols SCIP
1 // Copyright (c) 2021 Uber Technologies, Inc.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 // THE SOFTWARE.
20
21 package thriftudpscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/
22
23 import (
24 "fmtscip-go gomod github.com/golang/go/src go1.20 fmt/"
25 "testingscip-go gomod github.com/golang/go/src go1.20 testing/"
26
27 "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/"
28 "github.com/uber-go/tally/v4/thirdparty/github.com/apache/thrift/lib/go/thriftscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/thirdparty/github.com/apache/thrift/lib/go/thrift`/"
29 )
30
31 func TestNewTMultiUDPClientTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TestNewTMultiUDPClientTransport().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) {
32 trans, err := NewTMultiUDPClientTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/NewTMultiUDPClientTransport().([]string{"127.0.0.1:9090", "127.0.0.1:9090"}, "")
33 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NotNil().(t, trans)
34 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Nil().(t, err)
35 trans.Closescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#Close().()
36 }
37
38 func TestNewTMultiUDPClientTransportBadAddressscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TestNewTMultiUDPClientTransportBadAddress().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) {
39 trans, err := NewTMultiUDPClientTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/NewTMultiUDPClientTransport().([]string{"not an address"}, "")
40 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Nil().(t, trans)
41 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NotNil().(t, err)
42 }
43
44 func TestTMultiUDPTransportOpenscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TestTMultiUDPTransportOpen().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) {
45 trans, err := NewTMultiUDPClientTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/NewTMultiUDPClientTransport().([]string{}, "")
46 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Nil().(t, err)
47
48 trans.transportsscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#transports. = []thriftscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/thirdparty/github.com/apache/thrift/lib/go/thrift`/.TTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/thirdparty/github.com/apache/thrift/lib/go/thrift`/TTransport#{newMockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/newMockTransport().(), newMockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/newMockTransport().()}
49 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Nil().(t, trans.Openscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#Open().())
50
51 trans.Closescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#Close().()
52 }
53
54 func TestTMultiUDPTransportOpenFailscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TestTMultiUDPTransportOpenFail().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) {
55 trans, err := NewTMultiUDPClientTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/NewTMultiUDPClientTransport().([]string{}, "")
56 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Nil().(t, err)
57
58 trans.transportsscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#transports. = []thriftscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/thirdparty/github.com/apache/thrift/lib/go/thrift`/.TTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/thirdparty/github.com/apache/thrift/lib/go/thrift`/TTransport#{newMockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/newMockTransport().(), newMockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/newMockTransport().()}
59 trans.transportsscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#transports.[1].(*mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#).openErrorscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#openError. = fmtscip-go gomod github.com/golang/go/src go1.20 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.20 fmt/Errorf().("error")
60 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NotNil().(t, trans.Openscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#Open().())
61 trans.Closescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#Close().()
62 }
63
64 func TestTMultiUDPTransportIsOpenscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TestTMultiUDPTransportIsOpen().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) {
65 trans, err := NewTMultiUDPClientTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/NewTMultiUDPClientTransport().([]string{}, "")
66 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Nil().(t, err)
67
68 trans.transportsscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#transports. = []thriftscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/thirdparty/github.com/apache/thrift/lib/go/thrift`/.TTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/thirdparty/github.com/apache/thrift/lib/go/thrift`/TTransport#{newMockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/newMockTransport().(), newMockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/newMockTransport().()}
69 trans.transportsscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#transports.[0].(*mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#).currentlyOpenscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#currentlyOpen. = true
70 trans.transportsscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#transports.[1].(*mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#).currentlyOpenscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#currentlyOpen. = true
71 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/True().(t, trans.IsOpenscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#IsOpen().())
72 trans.Closescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#Close().()
73 }
74
75 func TestTMultiUDPTransportIsNotOpenscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TestTMultiUDPTransportIsNotOpen().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) {
76 trans, err := NewTMultiUDPClientTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/NewTMultiUDPClientTransport().([]string{}, "")
77 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Nil().(t, err)
78
79 trans.transportsscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#transports. = []thriftscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/thirdparty/github.com/apache/thrift/lib/go/thrift`/.TTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/thirdparty/github.com/apache/thrift/lib/go/thrift`/TTransport#{newMockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/newMockTransport().(), newMockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/newMockTransport().()}
80 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/False().(t, trans.IsOpenscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#IsOpen().())
81 trans.Closescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#Close().()
82 }
83
84 func TestTMultiUDPTransportReadNotSupportedscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TestTMultiUDPTransportReadNotSupported().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) {
85 trans, err := NewTMultiUDPClientTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/NewTMultiUDPClientTransport().([]string{}, "")
86 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Nil().(t, err)
87
88 n, err := trans.Readscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#Read().([]byte{})
89 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, int(0), n)
90 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NotNil().(t, err)
91 trans.Closescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#Close().()
92 }
93
94 func TestTMultiUDPTransportRemainingBytesNotSupportedscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TestTMultiUDPTransportRemainingBytesNotSupported().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) {
95 trans, err := NewTMultiUDPClientTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/NewTMultiUDPClientTransport().([]string{}, "")
96 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Nil().(t, err)
97
98 n := trans.RemainingBytesscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#RemainingBytes().()
99 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, uint64(0), n)
100 trans.Closescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#Close().()
101 }
102
103 func TestTMultiUDPTransportWritescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TestTMultiUDPTransportWrite().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) {
104 trans, err := NewTMultiUDPClientTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/NewTMultiUDPClientTransport().([]string{}, "")
105 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Nil().(t, err)
106
107 trans.transportsscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#transports. = []thriftscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/thirdparty/github.com/apache/thrift/lib/go/thrift`/.TTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/thirdparty/github.com/apache/thrift/lib/go/thrift`/TTransport#{newMockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/newMockTransport().(), newMockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/newMockTransport().()}
108 trans.transportsscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#transports.[0].(*mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#).onWritescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#onWrite. = func(buf []byte) (int, error) {
109 return len(buf), nil
110 }
111 trans.transportsscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#transports.[1].(*mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#).onWritescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#onWrite. = func(buf []byte) (int, error) {
112 return len(buf), nil
113 }
114
115 b := []byte{1, 2, 3}
116 n, err := trans.Writescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#Write().(b)
117 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, int(len(b)), n)
118 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Nil().(t, err)
119
120 trans.Flushscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#Flush().()
121 trans.Closescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#Close().()
122 }
123
124 func TestTMultiUDPTransportWriteErrorscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TestTMultiUDPTransportWriteError().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) {
125 trans, err := NewTMultiUDPClientTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/NewTMultiUDPClientTransport().([]string{}, "")
126 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Nil().(t, err)
127
128 trans.transportsscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#transports. = []thriftscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/thirdparty/github.com/apache/thrift/lib/go/thrift`/.TTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/thirdparty/github.com/apache/thrift/lib/go/thrift`/TTransport#{newMockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/newMockTransport().(), newMockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/newMockTransport().()}
129 trans.transportsscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#transports.[0].(*mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#).onWritescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#onWrite. = func(buf []byte) (int, error) {
130 return 0, fmtscip-go gomod github.com/golang/go/src go1.20 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.20 fmt/Errorf().("error")
131 }
132 trans.transportsscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#transports.[1].(*mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#).onWritescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#onWrite. = func(buf []byte) (int, error) {
133 return len(buf), nil
134 }
135
136 b := []byte{1, 2, 3}
137 n, err := trans.Writescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#Write().(b)
138 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, int(0), n)
139 assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NotNil().(t, err)
140 trans.Closescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/TMultiUDPTransport#Close().()
141 }
142
143 type mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport# struct {
144 currentlyOpenscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#currentlyOpen. bool
145 onReadscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#onRead. func(buf []byte) (int, error)
146 onRemainingBytesscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#onRemainingBytes. func() uint64
147 onWritescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#onWrite. func(buf []byte) (int, error)
148 onFlushscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#onFlush. func() error
149 openErrorscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#openError. error
150 closeErrorscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#closeError. error
151 }
152
153 func newMockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/newMockTransport().() *mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport# {
154 return &mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#{}
155 }
156
157 func (m *mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#) Openscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#Open().() error {
158 if m.openErrorscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#openError. != nil {
159 return m.openErrorscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#openError.
160 }
161 m.currentlyOpenscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#currentlyOpen. = true
162 return nil
163 }
164
165 func (m *mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#) IsOpenscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#IsOpen().() bool {
166 return m.currentlyOpenscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#currentlyOpen.
167 }
168
169 func (m *mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#) Closescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#Close().() error {
170 if m.closeErrorscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#closeError. != nil {
171 return m.closeErrorscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#closeError.
172 }
173 m.currentlyOpenscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#currentlyOpen. = false
174 return nil
175 }
176
177 func (m *mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#) Readscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#Read().(buf []byte) (int, error) {
178 if m.onReadscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#onRead. != nil {
179 return m.onReadscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#onRead.(buf)
180 }
181 return 0, fmtscip-go gomod github.com/golang/go/src go1.20 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.20 fmt/Errorf().("no mock Read implementation")
182 }
183
184 func (m *mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#) RemainingBytesscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#RemainingBytes().() uint64 {
185 if m.onRemainingBytesscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#onRemainingBytes. != nil {
186 return m.onRemainingBytesscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#onRemainingBytes.()
187 }
188 return 0
189 }
190
191 func (m *mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#) Writescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#Write().(buf []byte) (int, error) {
192 if m.onWritescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#onWrite. != nil {
193 return m.onWritescip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#onWrite.(buf)
194 }
195 return 0, fmtscip-go gomod github.com/golang/go/src go1.20 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.20 fmt/Errorf().("no mock Write implementation")
196 }
197
198 func (m *mockTransportscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#) Flushscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#Flush().() error {
199 if m.onFlushscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#onFlush. != nil {
200 return m.onFlushscip-go gomod github.com/uber-go/tally/v4 . `github.com/uber-go/tally/v4/m3/thriftudp`/mockTransport#onFlush.()
201 }
202 return fmtscip-go gomod github.com/golang/go/src go1.20 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.20 fmt/Errorf().("no mock Flush implementation")
203 }