blob: 48203b6739a864d655e32f5205f5c659fb35bd4e [file] [log] [blame]
Jens Geyerf4598682014-05-08 23:18:44 +02001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20package common
21
22import (
John Boiles57852792018-01-05 14:37:05 -080023 "context"
Jens Geyerf4598682014-05-08 23:18:44 +020024 "errors"
Yuxuan 'fishy' Wang91565d42024-08-14 09:01:15 -070025 "fmt"
Jens Geyerf4598682014-05-08 23:18:44 +020026 "reflect"
D. Can Celasun4f77ab82017-09-21 15:21:00 +020027 "sync"
Jens Geyerf4598682014-05-08 23:18:44 +020028 "testing"
claudemirof8ca0552016-01-10 23:31:30 -020029
30 "github.com/golang/mock/gomock"
Yuxuan 'fishy' Wangb71f11e2021-03-22 15:01:00 -070031
32 "github.com/apache/thrift/lib/go/thrift"
33 "github.com/apache/thrift/test/go/src/gen/thrifttest"
Jens Geyerf4598682014-05-08 23:18:44 +020034)
35
36type test_unit struct {
37 host string
38 port int64
39 domain_socket string
40 transport string
41 protocol string
42 ssl bool
43}
44
45var units = []test_unit{
Yuxuan 'fishy' Wang91565d42024-08-14 09:01:15 -070046 {"127.0.0.1", 0, "", "", "binary", false},
47 {"127.0.0.1", 0, "", "", "compact", false},
48 {"127.0.0.1", 0, "", "", "binary", true},
49 {"127.0.0.1", 0, "", "", "compact", true},
Jens Geyerf4598682014-05-08 23:18:44 +020050}
51
52func TestAllConnection(t *testing.T) {
D. Can Celasun4f77ab82017-09-21 15:21:00 +020053 wg := &sync.WaitGroup{}
54 wg.Add(len(units))
Jens Geyerf4598682014-05-08 23:18:44 +020055 for _, unit := range units {
D. Can Celasun4f77ab82017-09-21 15:21:00 +020056 go func(u test_unit) {
57 defer wg.Done()
58 doUnit(t, &u)
59 }(unit)
Jens Geyerf4598682014-05-08 23:18:44 +020060 }
D. Can Celasun4f77ab82017-09-21 15:21:00 +020061 wg.Wait()
Jens Geyerf4598682014-05-08 23:18:44 +020062}
63
64func doUnit(t *testing.T, unit *test_unit) {
Yuxuan 'fishy' Wang91565d42024-08-14 09:01:15 -070065 t.Run(fmt.Sprintf("%v", *unit), func(t *testing.T) {
66 ctrl := gomock.NewController(t)
67 defer ctrl.Finish()
68 handler := NewMockThriftTest(ctrl)
claudemirof8ca0552016-01-10 23:31:30 -020069
Yuxuan 'fishy' Wang91565d42024-08-14 09:01:15 -070070 processor, serverTransport, transportFactory, protocolFactory, addr, err := GetServerParams(unit.host, unit.port, unit.domain_socket, unit.transport, unit.protocol, unit.ssl, "../../../keys", handler)
71 if err != nil {
72 t.Errorf("GetServerParams failed: %v", err)
73 }
claudemirof8ca0552016-01-10 23:31:30 -020074
Yuxuan 'fishy' Wang91565d42024-08-14 09:01:15 -070075 server := thrift.NewTSimpleServer4(processor, serverTransport, transportFactory, protocolFactory)
76 if err = server.Listen(); err != nil {
77 t.Errorf("Unable to start server: %v", err)
78 return
79 }
80 go server.Serve()
81 defer server.Stop()
82 client, trans, err := StartClient(addr, unit.transport, unit.protocol, unit.ssl)
83 if err != nil {
84 t.Errorf("Unable to start client: %v", err)
85 return
86 }
87 defer trans.Close()
88 callEverythingWithMock(t, client, handler)
89 })
Jens Geyerf4598682014-05-08 23:18:44 +020090}
91
92var rmapmap = map[int32]map[int32]int32{
Yuxuan 'fishy' Wangb71f11e2021-03-22 15:01:00 -070093 -4: {-4: -4, -3: -3, -2: -2, -1: -1},
94 4: {4: 4, 3: 3, 2: 2, 1: 1},
Jens Geyerf4598682014-05-08 23:18:44 +020095}
96
97var xxs = &thrifttest.Xtruct{
98 StringThing: "Hello2",
99 ByteThing: 42,
100 I32Thing: 4242,
101 I64Thing: 424242,
102}
103
104var xcept = &thrifttest.Xception{ErrorCode: 1001, Message: "some"}
John Boiles57852792018-01-05 14:37:05 -0800105var defaultCtx = context.Background()
Jens Geyerf4598682014-05-08 23:18:44 +0200106
107func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, handler *MockThriftTest) {
Yuxuan 'fishy' Wang2acfe0f2022-10-21 10:27:40 -0700108 u := thrift.Tuuid{
109 0x00, 0x11, 0x22, 0x33,
110 0x44, 0x55,
111 0x66, 0x77,
112 0x88, 0x99,
113 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
114 }
Jens Geyerf4598682014-05-08 23:18:44 +0200115 gomock.InOrder(
taozlec0d384a2017-07-17 18:40:42 +0200116 handler.EXPECT().TestVoid(gomock.Any()),
117 handler.EXPECT().TestString(gomock.Any(), "thing").Return("thing", nil),
118 handler.EXPECT().TestBool(gomock.Any(), true).Return(true, nil),
119 handler.EXPECT().TestBool(gomock.Any(), false).Return(false, nil),
120 handler.EXPECT().TestByte(gomock.Any(), int8(42)).Return(int8(42), nil),
121 handler.EXPECT().TestI32(gomock.Any(), int32(4242)).Return(int32(4242), nil),
122 handler.EXPECT().TestI64(gomock.Any(), int64(424242)).Return(int64(424242), nil),
Jens Geyer8bcfdd92014-12-14 03:14:26 +0100123 // TODO: add TestBinary()
Yuxuan 'fishy' Wang2acfe0f2022-10-21 10:27:40 -0700124 handler.EXPECT().TestUuid(gomock.Any(), u).Return(u, nil),
taozlec0d384a2017-07-17 18:40:42 +0200125 handler.EXPECT().TestDouble(gomock.Any(), float64(42.42)).Return(float64(42.42), nil),
126 handler.EXPECT().TestStruct(gomock.Any(), &thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}).Return(&thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}, nil),
127 handler.EXPECT().TestNest(gomock.Any(), &thrifttest.Xtruct2{StructThing: &thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}}).Return(&thrifttest.Xtruct2{StructThing: &thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}}, nil),
128 handler.EXPECT().TestMap(gomock.Any(), map[int32]int32{1: 2, 3: 4, 5: 42}).Return(map[int32]int32{1: 2, 3: 4, 5: 42}, nil),
129 handler.EXPECT().TestStringMap(gomock.Any(), map[string]string{"a": "2", "b": "blah", "some": "thing"}).Return(map[string]string{"a": "2", "b": "blah", "some": "thing"}, nil),
130 handler.EXPECT().TestSet(gomock.Any(), []int32{1, 2, 42}).Return([]int32{1, 2, 42}, nil),
131 handler.EXPECT().TestList(gomock.Any(), []int32{1, 2, 42}).Return([]int32{1, 2, 42}, nil),
132 handler.EXPECT().TestEnum(gomock.Any(), thrifttest.Numberz_TWO).Return(thrifttest.Numberz_TWO, nil),
133 handler.EXPECT().TestTypedef(gomock.Any(), thrifttest.UserId(42)).Return(thrifttest.UserId(42), nil),
134 handler.EXPECT().TestMapMap(gomock.Any(), int32(42)).Return(rmapmap, nil),
Nobuaki Sukegawa2fab3de2015-08-16 15:42:58 +0900135 // TODO: not testing insanity
taozlec0d384a2017-07-17 18:40:42 +0200136 handler.EXPECT().TestMulti(gomock.Any(), int8(42), int32(4242), int64(424242), map[int16]string{1: "blah", 2: "thing"}, thrifttest.Numberz_EIGHT, thrifttest.UserId(24)).Return(xxs, nil),
137 handler.EXPECT().TestException(gomock.Any(), "some").Return(xcept),
138 handler.EXPECT().TestException(gomock.Any(), "TException").Return(errors.New("Just random exception")),
139 handler.EXPECT().TestMultiException(gomock.Any(), "Xception", "ignoreme").Return(nil, &thrifttest.Xception{ErrorCode: 1001, Message: "This is an Xception"}),
140 handler.EXPECT().TestMultiException(gomock.Any(), "Xception2", "ignoreme").Return(nil, &thrifttest.Xception2{ErrorCode: 2002, StructThing: &thrifttest.Xtruct{StringThing: "This is an Xception2"}}),
141 handler.EXPECT().TestOneway(gomock.Any(), int32(2)).Return(nil),
142 handler.EXPECT().TestVoid(gomock.Any()),
Jens Geyerf4598682014-05-08 23:18:44 +0200143 )
144 var err error
taozle5c302e02017-07-23 15:21:44 +0200145 if err = client.TestVoid(defaultCtx); err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100146 t.Errorf("Unexpected error in TestVoid() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200147 }
148
taozle5c302e02017-07-23 15:21:44 +0200149 thing, err := client.TestString(defaultCtx, "thing")
Jens Geyerf4598682014-05-08 23:18:44 +0200150 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100151 t.Errorf("Unexpected error in TestString() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200152 }
153 if thing != "thing" {
154 t.Errorf("Unexpected TestString() result, expected 'thing' got '%s' ", thing)
155 }
156
taozle5c302e02017-07-23 15:21:44 +0200157 bl, err := client.TestBool(defaultCtx, true)
Nobuaki Sukegawaa649e742015-09-21 13:53:25 +0900158 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100159 t.Errorf("Unexpected error in TestBool() call: %s", err)
Nobuaki Sukegawaa649e742015-09-21 13:53:25 +0900160 }
161 if !bl {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100162 t.Errorf("Unexpected TestBool() result expected true, got %v ", bl)
Nobuaki Sukegawaa649e742015-09-21 13:53:25 +0900163 }
taozle5c302e02017-07-23 15:21:44 +0200164 bl, err = client.TestBool(defaultCtx, false)
Nobuaki Sukegawaa649e742015-09-21 13:53:25 +0900165 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100166 t.Errorf("Unexpected error in TestBool() call: %s", err)
Nobuaki Sukegawaa649e742015-09-21 13:53:25 +0900167 }
168 if bl {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100169 t.Errorf("Unexpected TestBool() result expected false, got %v ", bl)
Nobuaki Sukegawaa649e742015-09-21 13:53:25 +0900170 }
171
taozle5c302e02017-07-23 15:21:44 +0200172 b, err := client.TestByte(defaultCtx, 42)
Jens Geyerf4598682014-05-08 23:18:44 +0200173 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100174 t.Errorf("Unexpected error in TestByte() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200175 }
176 if b != 42 {
177 t.Errorf("Unexpected TestByte() result expected 42, got %d ", b)
178 }
179
taozle5c302e02017-07-23 15:21:44 +0200180 i32, err := client.TestI32(defaultCtx, 4242)
Jens Geyerf4598682014-05-08 23:18:44 +0200181 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100182 t.Errorf("Unexpected error in TestI32() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200183 }
184 if i32 != 4242 {
185 t.Errorf("Unexpected TestI32() result expected 4242, got %d ", i32)
186 }
187
taozle5c302e02017-07-23 15:21:44 +0200188 i64, err := client.TestI64(defaultCtx, 424242)
Jens Geyerf4598682014-05-08 23:18:44 +0200189 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100190 t.Errorf("Unexpected error in TestI64() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200191 }
192 if i64 != 424242 {
193 t.Errorf("Unexpected TestI64() result expected 424242, got %d ", i64)
194 }
195
Yuxuan 'fishy' Wang2acfe0f2022-10-21 10:27:40 -0700196 // TODO: add TestBinary() call
197
198 uret, err := client.TestUuid(defaultCtx, u)
199 if err != nil {
200 t.Errorf("Unexpected error in TestUuid() call: %s", err)
201 }
202 if uret != u {
203 t.Errorf("Unexpected TestUuid() result expected %v, got %v ", uret, u)
204 }
205
taozle5c302e02017-07-23 15:21:44 +0200206 d, err := client.TestDouble(defaultCtx, 42.42)
Jens Geyerf4598682014-05-08 23:18:44 +0200207 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100208 t.Errorf("Unexpected error in TestDouble() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200209 }
210 if d != 42.42 {
211 t.Errorf("Unexpected TestDouble() result expected 42.42, got %f ", d)
212 }
213
Jens Geyerf4598682014-05-08 23:18:44 +0200214 xs := thrifttest.NewXtruct()
215 xs.StringThing = "thing"
216 xs.ByteThing = 42
217 xs.I32Thing = 4242
218 xs.I64Thing = 424242
taozle5c302e02017-07-23 15:21:44 +0200219 xsret, err := client.TestStruct(defaultCtx, xs)
Jens Geyerf4598682014-05-08 23:18:44 +0200220 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100221 t.Errorf("Unexpected error in TestStruct() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200222 }
223 if *xs != *xsret {
224 t.Errorf("Unexpected TestStruct() result expected %#v, got %#v ", xs, xsret)
225 }
226
227 x2 := thrifttest.NewXtruct2()
228 x2.StructThing = xs
taozle5c302e02017-07-23 15:21:44 +0200229 x2ret, err := client.TestNest(defaultCtx, x2)
Jens Geyerf4598682014-05-08 23:18:44 +0200230 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100231 t.Errorf("Unexpected error in TestNest() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200232 }
233 if !reflect.DeepEqual(x2, x2ret) {
234 t.Errorf("Unexpected TestNest() result expected %#v, got %#v ", x2, x2ret)
235 }
236
237 m := map[int32]int32{1: 2, 3: 4, 5: 42}
taozle5c302e02017-07-23 15:21:44 +0200238 mret, err := client.TestMap(defaultCtx, m)
Jens Geyerf4598682014-05-08 23:18:44 +0200239 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100240 t.Errorf("Unexpected error in TestMap() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200241 }
242 if !reflect.DeepEqual(m, mret) {
243 t.Errorf("Unexpected TestMap() result expected %#v, got %#v ", m, mret)
244 }
245
246 sm := map[string]string{"a": "2", "b": "blah", "some": "thing"}
taozle5c302e02017-07-23 15:21:44 +0200247 smret, err := client.TestStringMap(defaultCtx, sm)
Jens Geyerf4598682014-05-08 23:18:44 +0200248 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100249 t.Errorf("Unexpected error in TestStringMap() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200250 }
251 if !reflect.DeepEqual(sm, smret) {
252 t.Errorf("Unexpected TestStringMap() result expected %#v, got %#v ", sm, smret)
253 }
254
D. Can Celasun43fb34d2017-01-15 10:53:19 +0100255 s := []int32{1, 2, 42}
taozle5c302e02017-07-23 15:21:44 +0200256 sret, err := client.TestSet(defaultCtx, s)
Jens Geyerf4598682014-05-08 23:18:44 +0200257 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100258 t.Errorf("Unexpected error in TestSet() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200259 }
D. Can Celasun43fb34d2017-01-15 10:53:19 +0100260 // Sets can be in any order, but Go slices are ordered, so reflect.DeepEqual won't work.
261 stemp := map[int32]struct{}{}
262 for _, val := range s {
263 stemp[val] = struct{}{}
264 }
265 for _, val := range sret {
266 if _, ok := stemp[val]; !ok {
267 t.Fatalf("Unexpected TestSet() result expected %#v, got %#v ", s, sret)
268 }
Jens Geyerf4598682014-05-08 23:18:44 +0200269 }
270
271 l := []int32{1, 2, 42}
taozle5c302e02017-07-23 15:21:44 +0200272 lret, err := client.TestList(defaultCtx, l)
Jens Geyerf4598682014-05-08 23:18:44 +0200273 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100274 t.Errorf("Unexpected error in TestList() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200275 }
276 if !reflect.DeepEqual(l, lret) {
D. Can Celasun43fb34d2017-01-15 10:53:19 +0100277 t.Errorf("Unexpected TestList() result expected %#v, got %#v ", l, lret)
Jens Geyerf4598682014-05-08 23:18:44 +0200278 }
279
taozle5c302e02017-07-23 15:21:44 +0200280 eret, err := client.TestEnum(defaultCtx, thrifttest.Numberz_TWO)
Jens Geyerf4598682014-05-08 23:18:44 +0200281 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100282 t.Errorf("Unexpected error in TestEnum() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200283 }
284 if eret != thrifttest.Numberz_TWO {
285 t.Errorf("Unexpected TestEnum() result expected %#v, got %#v ", thrifttest.Numberz_TWO, eret)
286 }
287
taozle5c302e02017-07-23 15:21:44 +0200288 tret, err := client.TestTypedef(defaultCtx, thrifttest.UserId(42))
Jens Geyerf4598682014-05-08 23:18:44 +0200289 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100290 t.Errorf("Unexpected error in TestTypedef() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200291 }
292 if tret != thrifttest.UserId(42) {
293 t.Errorf("Unexpected TestTypedef() result expected %#v, got %#v ", thrifttest.UserId(42), tret)
294 }
295
taozle5c302e02017-07-23 15:21:44 +0200296 mapmap, err := client.TestMapMap(defaultCtx, 42)
Jens Geyerf4598682014-05-08 23:18:44 +0200297 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100298 t.Errorf("Unexpected error in TestMapmap() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200299 }
300 if !reflect.DeepEqual(mapmap, rmapmap) {
301 t.Errorf("Unexpected TestMapmap() result expected %#v, got %#v ", rmapmap, mapmap)
302 }
303
taozle5c302e02017-07-23 15:21:44 +0200304 xxsret, err := client.TestMulti(defaultCtx, 42, 4242, 424242, map[int16]string{1: "blah", 2: "thing"}, thrifttest.Numberz_EIGHT, thrifttest.UserId(24))
Jens Geyerf4598682014-05-08 23:18:44 +0200305 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100306 t.Errorf("Unexpected error in TestMulti() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200307 }
308 if !reflect.DeepEqual(xxs, xxsret) {
309 t.Errorf("Unexpected TestMulti() result expected %#v, got %#v ", xxs, xxsret)
310 }
311
taozle5c302e02017-07-23 15:21:44 +0200312 err = client.TestException(defaultCtx, "some")
Jens Geyerf4598682014-05-08 23:18:44 +0200313 if err == nil {
314 t.Errorf("Expecting exception in TestException() call")
315 }
316 if !reflect.DeepEqual(err, xcept) {
317 t.Errorf("Unexpected TestException() result expected %#v, got %#v ", xcept, err)
318 }
319
320 // TODO: connection is being closed on this
taozle5c302e02017-07-23 15:21:44 +0200321 err = client.TestException(defaultCtx, "TException")
D. Can Celasun4f77ab82017-09-21 15:21:00 +0200322 if err == nil {
323 t.Error("expected exception got nil")
324 } else if tex, ok := err.(thrift.TApplicationException); !ok {
325 t.Errorf("Unexpected TestException() result expected ApplicationError, got %T ", err)
326 } else if tex.TypeId() != thrift.INTERNAL_ERROR {
327 t.Errorf("expected internal_error got %v", tex.TypeId())
Jens Geyerf4598682014-05-08 23:18:44 +0200328 }
329
taozle5c302e02017-07-23 15:21:44 +0200330 ign, err := client.TestMultiException(defaultCtx, "Xception", "ignoreme")
Jens Geyerf4598682014-05-08 23:18:44 +0200331 if ign != nil || err == nil {
332 t.Errorf("Expecting exception in TestMultiException() call")
333 }
334 if !reflect.DeepEqual(err, &thrifttest.Xception{ErrorCode: 1001, Message: "This is an Xception"}) {
335 t.Errorf("Unexpected TestMultiException() %#v ", err)
336 }
337
taozle5c302e02017-07-23 15:21:44 +0200338 ign, err = client.TestMultiException(defaultCtx, "Xception2", "ignoreme")
Jens Geyerf4598682014-05-08 23:18:44 +0200339 if ign != nil || err == nil {
340 t.Errorf("Expecting exception in TestMultiException() call")
341 }
342 expecting := &thrifttest.Xception2{ErrorCode: 2002, StructThing: &thrifttest.Xtruct{StringThing: "This is an Xception2"}}
343
344 if !reflect.DeepEqual(err, expecting) {
345 t.Errorf("Unexpected TestMultiException() %#v ", err)
346 }
347
taozle5c302e02017-07-23 15:21:44 +0200348 err = client.TestOneway(defaultCtx, 2)
Jens Geyerf4598682014-05-08 23:18:44 +0200349 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100350 t.Errorf("Unexpected error in TestOneway() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200351 }
352
353 //Make sure the connection still alive
taozle5c302e02017-07-23 15:21:44 +0200354 if err = client.TestVoid(defaultCtx); err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100355 t.Errorf("Unexpected error in TestVoid() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200356 }
357}