blob: a39519d8a5683aa56870d140324026901e2b72d1 [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"
Jens Geyerf4598682014-05-08 23:18:44 +020025 "reflect"
D. Can Celasun4f77ab82017-09-21 15:21:00 +020026 "sync"
Jens Geyerf4598682014-05-08 23:18:44 +020027 "testing"
claudemirof8ca0552016-01-10 23:31:30 -020028
29 "github.com/golang/mock/gomock"
Yuxuan 'fishy' Wangb71f11e2021-03-22 15:01:00 -070030
31 "github.com/apache/thrift/lib/go/thrift"
32 "github.com/apache/thrift/test/go/src/gen/thrifttest"
Jens Geyerf4598682014-05-08 23:18:44 +020033)
34
35type test_unit struct {
36 host string
37 port int64
38 domain_socket string
39 transport string
40 protocol string
41 ssl bool
42}
43
44var units = []test_unit{
Nobuaki Sukegawafd02a302016-08-16 14:06:48 +090045 {"127.0.0.1", 9095, "", "", "binary", false},
Jens Geyerf4598682014-05-08 23:18:44 +020046 {"127.0.0.1", 9091, "", "", "compact", false},
47 {"127.0.0.1", 9092, "", "", "binary", true},
48 {"127.0.0.1", 9093, "", "", "compact", true},
49}
50
51func TestAllConnection(t *testing.T) {
D. Can Celasun4f77ab82017-09-21 15:21:00 +020052 wg := &sync.WaitGroup{}
53 wg.Add(len(units))
Jens Geyerf4598682014-05-08 23:18:44 +020054 for _, unit := range units {
D. Can Celasun4f77ab82017-09-21 15:21:00 +020055 go func(u test_unit) {
56 defer wg.Done()
57 doUnit(t, &u)
58 }(unit)
Jens Geyerf4598682014-05-08 23:18:44 +020059 }
D. Can Celasun4f77ab82017-09-21 15:21:00 +020060 wg.Wait()
Jens Geyerf4598682014-05-08 23:18:44 +020061}
62
63func doUnit(t *testing.T, unit *test_unit) {
64 ctrl := gomock.NewController(t)
65 defer ctrl.Finish()
66 handler := NewMockThriftTest(ctrl)
claudemirof8ca0552016-01-10 23:31:30 -020067
68 processor, serverTransport, transportFactory, protocolFactory, err := GetServerParams(unit.host, unit.port, unit.domain_socket, unit.transport, unit.protocol, unit.ssl, "../../../keys", handler)
Yuxuan 'fishy' Wang17373a32021-08-26 11:04:27 -070069 if err != nil {
70 t.Errorf("GetServerParams failed: %v", err)
71 }
claudemirof8ca0552016-01-10 23:31:30 -020072
73 server := thrift.NewTSimpleServer4(processor, serverTransport, transportFactory, protocolFactory)
74 if err = server.Listen(); err != nil {
D. Can Celasun4f77ab82017-09-21 15:21:00 +020075 t.Errorf("Unable to start server: %v", err)
76 return
Jens Geyerf4598682014-05-08 23:18:44 +020077 }
郑桐2fa907e2022-01-04 18:20:24 +080078 go server.Serve()
Jens Geyerf4598682014-05-08 23:18:44 +020079 defer server.Stop()
D. Can Celasun4f77ab82017-09-21 15:21:00 +020080 client, trans, err := StartClient(unit.host, unit.port, unit.domain_socket, unit.transport, unit.protocol, unit.ssl)
Jens Geyerf4598682014-05-08 23:18:44 +020081 if err != nil {
D. Can Celasun4f77ab82017-09-21 15:21:00 +020082 t.Errorf("Unable to start client: %v", err)
83 return
Jens Geyerf4598682014-05-08 23:18:44 +020084 }
D. Can Celasun4f77ab82017-09-21 15:21:00 +020085 defer trans.Close()
Jens Geyerf4598682014-05-08 23:18:44 +020086 callEverythingWithMock(t, client, handler)
87}
88
89var rmapmap = map[int32]map[int32]int32{
Yuxuan 'fishy' Wangb71f11e2021-03-22 15:01:00 -070090 -4: {-4: -4, -3: -3, -2: -2, -1: -1},
91 4: {4: 4, 3: 3, 2: 2, 1: 1},
Jens Geyerf4598682014-05-08 23:18:44 +020092}
93
94var xxs = &thrifttest.Xtruct{
95 StringThing: "Hello2",
96 ByteThing: 42,
97 I32Thing: 4242,
98 I64Thing: 424242,
99}
100
101var xcept = &thrifttest.Xception{ErrorCode: 1001, Message: "some"}
John Boiles57852792018-01-05 14:37:05 -0800102var defaultCtx = context.Background()
Jens Geyerf4598682014-05-08 23:18:44 +0200103
104func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, handler *MockThriftTest) {
Yuxuan 'fishy' Wang2acfe0f2022-10-21 10:27:40 -0700105 u := thrift.Tuuid{
106 0x00, 0x11, 0x22, 0x33,
107 0x44, 0x55,
108 0x66, 0x77,
109 0x88, 0x99,
110 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
111 }
Jens Geyerf4598682014-05-08 23:18:44 +0200112 gomock.InOrder(
taozlec0d384a2017-07-17 18:40:42 +0200113 handler.EXPECT().TestVoid(gomock.Any()),
114 handler.EXPECT().TestString(gomock.Any(), "thing").Return("thing", nil),
115 handler.EXPECT().TestBool(gomock.Any(), true).Return(true, nil),
116 handler.EXPECT().TestBool(gomock.Any(), false).Return(false, nil),
117 handler.EXPECT().TestByte(gomock.Any(), int8(42)).Return(int8(42), nil),
118 handler.EXPECT().TestI32(gomock.Any(), int32(4242)).Return(int32(4242), nil),
119 handler.EXPECT().TestI64(gomock.Any(), int64(424242)).Return(int64(424242), nil),
Jens Geyer8bcfdd92014-12-14 03:14:26 +0100120 // TODO: add TestBinary()
Yuxuan 'fishy' Wang2acfe0f2022-10-21 10:27:40 -0700121 handler.EXPECT().TestUuid(gomock.Any(), u).Return(u, nil),
taozlec0d384a2017-07-17 18:40:42 +0200122 handler.EXPECT().TestDouble(gomock.Any(), float64(42.42)).Return(float64(42.42), nil),
123 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),
124 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),
125 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),
126 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),
127 handler.EXPECT().TestSet(gomock.Any(), []int32{1, 2, 42}).Return([]int32{1, 2, 42}, nil),
128 handler.EXPECT().TestList(gomock.Any(), []int32{1, 2, 42}).Return([]int32{1, 2, 42}, nil),
129 handler.EXPECT().TestEnum(gomock.Any(), thrifttest.Numberz_TWO).Return(thrifttest.Numberz_TWO, nil),
130 handler.EXPECT().TestTypedef(gomock.Any(), thrifttest.UserId(42)).Return(thrifttest.UserId(42), nil),
131 handler.EXPECT().TestMapMap(gomock.Any(), int32(42)).Return(rmapmap, nil),
Nobuaki Sukegawa2fab3de2015-08-16 15:42:58 +0900132 // TODO: not testing insanity
taozlec0d384a2017-07-17 18:40:42 +0200133 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),
134 handler.EXPECT().TestException(gomock.Any(), "some").Return(xcept),
135 handler.EXPECT().TestException(gomock.Any(), "TException").Return(errors.New("Just random exception")),
136 handler.EXPECT().TestMultiException(gomock.Any(), "Xception", "ignoreme").Return(nil, &thrifttest.Xception{ErrorCode: 1001, Message: "This is an Xception"}),
137 handler.EXPECT().TestMultiException(gomock.Any(), "Xception2", "ignoreme").Return(nil, &thrifttest.Xception2{ErrorCode: 2002, StructThing: &thrifttest.Xtruct{StringThing: "This is an Xception2"}}),
138 handler.EXPECT().TestOneway(gomock.Any(), int32(2)).Return(nil),
139 handler.EXPECT().TestVoid(gomock.Any()),
Jens Geyerf4598682014-05-08 23:18:44 +0200140 )
141 var err error
taozle5c302e02017-07-23 15:21:44 +0200142 if err = client.TestVoid(defaultCtx); err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100143 t.Errorf("Unexpected error in TestVoid() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200144 }
145
taozle5c302e02017-07-23 15:21:44 +0200146 thing, err := client.TestString(defaultCtx, "thing")
Jens Geyerf4598682014-05-08 23:18:44 +0200147 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100148 t.Errorf("Unexpected error in TestString() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200149 }
150 if thing != "thing" {
151 t.Errorf("Unexpected TestString() result, expected 'thing' got '%s' ", thing)
152 }
153
taozle5c302e02017-07-23 15:21:44 +0200154 bl, err := client.TestBool(defaultCtx, true)
Nobuaki Sukegawaa649e742015-09-21 13:53:25 +0900155 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100156 t.Errorf("Unexpected error in TestBool() call: %s", err)
Nobuaki Sukegawaa649e742015-09-21 13:53:25 +0900157 }
158 if !bl {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100159 t.Errorf("Unexpected TestBool() result expected true, got %v ", bl)
Nobuaki Sukegawaa649e742015-09-21 13:53:25 +0900160 }
taozle5c302e02017-07-23 15:21:44 +0200161 bl, err = client.TestBool(defaultCtx, false)
Nobuaki Sukegawaa649e742015-09-21 13:53:25 +0900162 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100163 t.Errorf("Unexpected error in TestBool() call: %s", err)
Nobuaki Sukegawaa649e742015-09-21 13:53:25 +0900164 }
165 if bl {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100166 t.Errorf("Unexpected TestBool() result expected false, got %v ", bl)
Nobuaki Sukegawaa649e742015-09-21 13:53:25 +0900167 }
168
taozle5c302e02017-07-23 15:21:44 +0200169 b, err := client.TestByte(defaultCtx, 42)
Jens Geyerf4598682014-05-08 23:18:44 +0200170 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100171 t.Errorf("Unexpected error in TestByte() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200172 }
173 if b != 42 {
174 t.Errorf("Unexpected TestByte() result expected 42, got %d ", b)
175 }
176
taozle5c302e02017-07-23 15:21:44 +0200177 i32, err := client.TestI32(defaultCtx, 4242)
Jens Geyerf4598682014-05-08 23:18:44 +0200178 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100179 t.Errorf("Unexpected error in TestI32() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200180 }
181 if i32 != 4242 {
182 t.Errorf("Unexpected TestI32() result expected 4242, got %d ", i32)
183 }
184
taozle5c302e02017-07-23 15:21:44 +0200185 i64, err := client.TestI64(defaultCtx, 424242)
Jens Geyerf4598682014-05-08 23:18:44 +0200186 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100187 t.Errorf("Unexpected error in TestI64() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200188 }
189 if i64 != 424242 {
190 t.Errorf("Unexpected TestI64() result expected 424242, got %d ", i64)
191 }
192
Yuxuan 'fishy' Wang2acfe0f2022-10-21 10:27:40 -0700193 // TODO: add TestBinary() call
194
195 uret, err := client.TestUuid(defaultCtx, u)
196 if err != nil {
197 t.Errorf("Unexpected error in TestUuid() call: %s", err)
198 }
199 if uret != u {
200 t.Errorf("Unexpected TestUuid() result expected %v, got %v ", uret, u)
201 }
202
taozle5c302e02017-07-23 15:21:44 +0200203 d, err := client.TestDouble(defaultCtx, 42.42)
Jens Geyerf4598682014-05-08 23:18:44 +0200204 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100205 t.Errorf("Unexpected error in TestDouble() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200206 }
207 if d != 42.42 {
208 t.Errorf("Unexpected TestDouble() result expected 42.42, got %f ", d)
209 }
210
Jens Geyerf4598682014-05-08 23:18:44 +0200211 xs := thrifttest.NewXtruct()
212 xs.StringThing = "thing"
213 xs.ByteThing = 42
214 xs.I32Thing = 4242
215 xs.I64Thing = 424242
taozle5c302e02017-07-23 15:21:44 +0200216 xsret, err := client.TestStruct(defaultCtx, xs)
Jens Geyerf4598682014-05-08 23:18:44 +0200217 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100218 t.Errorf("Unexpected error in TestStruct() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200219 }
220 if *xs != *xsret {
221 t.Errorf("Unexpected TestStruct() result expected %#v, got %#v ", xs, xsret)
222 }
223
224 x2 := thrifttest.NewXtruct2()
225 x2.StructThing = xs
taozle5c302e02017-07-23 15:21:44 +0200226 x2ret, err := client.TestNest(defaultCtx, x2)
Jens Geyerf4598682014-05-08 23:18:44 +0200227 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100228 t.Errorf("Unexpected error in TestNest() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200229 }
230 if !reflect.DeepEqual(x2, x2ret) {
231 t.Errorf("Unexpected TestNest() result expected %#v, got %#v ", x2, x2ret)
232 }
233
234 m := map[int32]int32{1: 2, 3: 4, 5: 42}
taozle5c302e02017-07-23 15:21:44 +0200235 mret, err := client.TestMap(defaultCtx, m)
Jens Geyerf4598682014-05-08 23:18:44 +0200236 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100237 t.Errorf("Unexpected error in TestMap() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200238 }
239 if !reflect.DeepEqual(m, mret) {
240 t.Errorf("Unexpected TestMap() result expected %#v, got %#v ", m, mret)
241 }
242
243 sm := map[string]string{"a": "2", "b": "blah", "some": "thing"}
taozle5c302e02017-07-23 15:21:44 +0200244 smret, err := client.TestStringMap(defaultCtx, sm)
Jens Geyerf4598682014-05-08 23:18:44 +0200245 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100246 t.Errorf("Unexpected error in TestStringMap() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200247 }
248 if !reflect.DeepEqual(sm, smret) {
249 t.Errorf("Unexpected TestStringMap() result expected %#v, got %#v ", sm, smret)
250 }
251
D. Can Celasun43fb34d2017-01-15 10:53:19 +0100252 s := []int32{1, 2, 42}
taozle5c302e02017-07-23 15:21:44 +0200253 sret, err := client.TestSet(defaultCtx, s)
Jens Geyerf4598682014-05-08 23:18:44 +0200254 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100255 t.Errorf("Unexpected error in TestSet() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200256 }
D. Can Celasun43fb34d2017-01-15 10:53:19 +0100257 // Sets can be in any order, but Go slices are ordered, so reflect.DeepEqual won't work.
258 stemp := map[int32]struct{}{}
259 for _, val := range s {
260 stemp[val] = struct{}{}
261 }
262 for _, val := range sret {
263 if _, ok := stemp[val]; !ok {
264 t.Fatalf("Unexpected TestSet() result expected %#v, got %#v ", s, sret)
265 }
Jens Geyerf4598682014-05-08 23:18:44 +0200266 }
267
268 l := []int32{1, 2, 42}
taozle5c302e02017-07-23 15:21:44 +0200269 lret, err := client.TestList(defaultCtx, l)
Jens Geyerf4598682014-05-08 23:18:44 +0200270 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100271 t.Errorf("Unexpected error in TestList() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200272 }
273 if !reflect.DeepEqual(l, lret) {
D. Can Celasun43fb34d2017-01-15 10:53:19 +0100274 t.Errorf("Unexpected TestList() result expected %#v, got %#v ", l, lret)
Jens Geyerf4598682014-05-08 23:18:44 +0200275 }
276
taozle5c302e02017-07-23 15:21:44 +0200277 eret, err := client.TestEnum(defaultCtx, thrifttest.Numberz_TWO)
Jens Geyerf4598682014-05-08 23:18:44 +0200278 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100279 t.Errorf("Unexpected error in TestEnum() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200280 }
281 if eret != thrifttest.Numberz_TWO {
282 t.Errorf("Unexpected TestEnum() result expected %#v, got %#v ", thrifttest.Numberz_TWO, eret)
283 }
284
taozle5c302e02017-07-23 15:21:44 +0200285 tret, err := client.TestTypedef(defaultCtx, thrifttest.UserId(42))
Jens Geyerf4598682014-05-08 23:18:44 +0200286 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100287 t.Errorf("Unexpected error in TestTypedef() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200288 }
289 if tret != thrifttest.UserId(42) {
290 t.Errorf("Unexpected TestTypedef() result expected %#v, got %#v ", thrifttest.UserId(42), tret)
291 }
292
taozle5c302e02017-07-23 15:21:44 +0200293 mapmap, err := client.TestMapMap(defaultCtx, 42)
Jens Geyerf4598682014-05-08 23:18:44 +0200294 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100295 t.Errorf("Unexpected error in TestMapmap() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200296 }
297 if !reflect.DeepEqual(mapmap, rmapmap) {
298 t.Errorf("Unexpected TestMapmap() result expected %#v, got %#v ", rmapmap, mapmap)
299 }
300
taozle5c302e02017-07-23 15:21:44 +0200301 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 +0200302 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100303 t.Errorf("Unexpected error in TestMulti() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200304 }
305 if !reflect.DeepEqual(xxs, xxsret) {
306 t.Errorf("Unexpected TestMulti() result expected %#v, got %#v ", xxs, xxsret)
307 }
308
taozle5c302e02017-07-23 15:21:44 +0200309 err = client.TestException(defaultCtx, "some")
Jens Geyerf4598682014-05-08 23:18:44 +0200310 if err == nil {
311 t.Errorf("Expecting exception in TestException() call")
312 }
313 if !reflect.DeepEqual(err, xcept) {
314 t.Errorf("Unexpected TestException() result expected %#v, got %#v ", xcept, err)
315 }
316
317 // TODO: connection is being closed on this
taozle5c302e02017-07-23 15:21:44 +0200318 err = client.TestException(defaultCtx, "TException")
D. Can Celasun4f77ab82017-09-21 15:21:00 +0200319 if err == nil {
320 t.Error("expected exception got nil")
321 } else if tex, ok := err.(thrift.TApplicationException); !ok {
322 t.Errorf("Unexpected TestException() result expected ApplicationError, got %T ", err)
323 } else if tex.TypeId() != thrift.INTERNAL_ERROR {
324 t.Errorf("expected internal_error got %v", tex.TypeId())
Jens Geyerf4598682014-05-08 23:18:44 +0200325 }
326
taozle5c302e02017-07-23 15:21:44 +0200327 ign, err := client.TestMultiException(defaultCtx, "Xception", "ignoreme")
Jens Geyerf4598682014-05-08 23:18:44 +0200328 if ign != nil || err == nil {
329 t.Errorf("Expecting exception in TestMultiException() call")
330 }
331 if !reflect.DeepEqual(err, &thrifttest.Xception{ErrorCode: 1001, Message: "This is an Xception"}) {
332 t.Errorf("Unexpected TestMultiException() %#v ", err)
333 }
334
taozle5c302e02017-07-23 15:21:44 +0200335 ign, err = client.TestMultiException(defaultCtx, "Xception2", "ignoreme")
Jens Geyerf4598682014-05-08 23:18:44 +0200336 if ign != nil || err == nil {
337 t.Errorf("Expecting exception in TestMultiException() call")
338 }
339 expecting := &thrifttest.Xception2{ErrorCode: 2002, StructThing: &thrifttest.Xtruct{StringThing: "This is an Xception2"}}
340
341 if !reflect.DeepEqual(err, expecting) {
342 t.Errorf("Unexpected TestMultiException() %#v ", err)
343 }
344
taozle5c302e02017-07-23 15:21:44 +0200345 err = client.TestOneway(defaultCtx, 2)
Jens Geyerf4598682014-05-08 23:18:44 +0200346 if err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100347 t.Errorf("Unexpected error in TestOneway() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200348 }
349
350 //Make sure the connection still alive
taozle5c302e02017-07-23 15:21:44 +0200351 if err = client.TestVoid(defaultCtx); err != nil {
D. Can Celasuna9efd1a2018-03-15 12:52:37 +0100352 t.Errorf("Unexpected error in TestVoid() call: %s", err)
Jens Geyerf4598682014-05-08 23:18:44 +0200353 }
354}