Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 20 | package main |
| 21 | |
| 22 | import ( |
John Boiles | 5785279 | 2018-01-05 14:37:05 -0800 | [diff] [blame] | 23 | "context" |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 24 | "flag" |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 25 | t "log" |
| 26 | "reflect" |
Yuxuan 'fishy' Wang | b71f11e | 2021-03-22 15:01:00 -0700 | [diff] [blame] | 27 | |
| 28 | "github.com/apache/thrift/lib/go/thrift" |
| 29 | "github.com/apache/thrift/test/go/src/common" |
| 30 | "github.com/apache/thrift/test/go/src/gen/thrifttest" |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 31 | ) |
| 32 | |
| 33 | var host = flag.String("host", "localhost", "Host to connect") |
| 34 | var port = flag.Int64("port", 9090, "Port number to connect") |
| 35 | var domain_socket = flag.String("domain-socket", "", "Domain Socket (e.g. /tmp/thrifttest.thrift), instead of host and port") |
Jens Geyer | c6b991f | 2015-08-07 23:41:09 +0200 | [diff] [blame] | 36 | var transport = flag.String("transport", "buffered", "Transport: buffered, framed, http, zlib") |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 37 | var protocol = flag.String("protocol", "binary", "Protocol: binary, compact, json") |
| 38 | var ssl = flag.Bool("ssl", false, "Encrypted Transport using SSL") |
James E. King III | b2b767e | 2018-09-15 20:32:04 +0000 | [diff] [blame] | 39 | var zlib = flag.Bool("zlib", false, "Wrapped Transport using Zlib") |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 40 | var testloops = flag.Int("testloops", 1, "Number of Tests") |
| 41 | |
| 42 | func main() { |
| 43 | flag.Parse() |
D. Can Celasun | 4f77ab8 | 2017-09-21 15:21:00 +0200 | [diff] [blame] | 44 | client, _, err := common.StartClient(*host, *port, *domain_socket, *transport, *protocol, *ssl) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 45 | if err != nil { |
| 46 | t.Fatalf("Unable to start client: ", err) |
| 47 | } |
| 48 | for i := 0; i < *testloops; i++ { |
| 49 | callEverything(client) |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | var rmapmap = map[int32]map[int32]int32{ |
Yuxuan 'fishy' Wang | b71f11e | 2021-03-22 15:01:00 -0700 | [diff] [blame] | 54 | -4: {-4: -4, -3: -3, -2: -2, -1: -1}, |
| 55 | 4: {4: 4, 3: 3, 2: 2, 1: 1}, |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | var xxs = &thrifttest.Xtruct{ |
| 59 | StringThing: "Hello2", |
| 60 | ByteThing: 42, |
| 61 | I32Thing: 4242, |
| 62 | I64Thing: 424242, |
| 63 | } |
| 64 | |
| 65 | var xcept = &thrifttest.Xception{ErrorCode: 1001, Message: "Xception"} |
John Boiles | 5785279 | 2018-01-05 14:37:05 -0800 | [diff] [blame] | 66 | var defaultCtx = context.Background() |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 67 | |
| 68 | func callEverything(client *thrifttest.ThriftTestClient) { |
| 69 | var err error |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 70 | if err = client.TestVoid(defaultCtx); err != nil { |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 71 | t.Fatalf("Unexpected error in TestVoid() call: ", err) |
| 72 | } |
| 73 | |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 74 | thing, err := client.TestString(defaultCtx, "thing") |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 75 | if err != nil { |
| 76 | t.Fatalf("Unexpected error in TestString() call: ", err) |
| 77 | } |
| 78 | if thing != "thing" { |
| 79 | t.Fatalf("Unexpected TestString() result, expected 'thing' got '%s' ", thing) |
| 80 | } |
| 81 | |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 82 | bl, err := client.TestBool(defaultCtx, true) |
Nobuaki Sukegawa | a649e74 | 2015-09-21 13:53:25 +0900 | [diff] [blame] | 83 | if err != nil { |
| 84 | t.Fatalf("Unexpected error in TestBool() call: ", err) |
| 85 | } |
| 86 | if !bl { |
| 87 | t.Fatalf("Unexpected TestBool() result expected true, got %f ", bl) |
| 88 | } |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 89 | bl, err = client.TestBool(defaultCtx, false) |
Nobuaki Sukegawa | a649e74 | 2015-09-21 13:53:25 +0900 | [diff] [blame] | 90 | if err != nil { |
| 91 | t.Fatalf("Unexpected error in TestBool() call: ", err) |
| 92 | } |
| 93 | if bl { |
| 94 | t.Fatalf("Unexpected TestBool() result expected false, got %f ", bl) |
| 95 | } |
| 96 | |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 97 | b, err := client.TestByte(defaultCtx, 42) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 98 | if err != nil { |
| 99 | t.Fatalf("Unexpected error in TestByte() call: ", err) |
| 100 | } |
| 101 | if b != 42 { |
| 102 | t.Fatalf("Unexpected TestByte() result expected 42, got %d ", b) |
| 103 | } |
| 104 | |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 105 | i32, err := client.TestI32(defaultCtx, 4242) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 106 | if err != nil { |
| 107 | t.Fatalf("Unexpected error in TestI32() call: ", err) |
| 108 | } |
| 109 | if i32 != 4242 { |
| 110 | t.Fatalf("Unexpected TestI32() result expected 4242, got %d ", i32) |
| 111 | } |
| 112 | |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 113 | i64, err := client.TestI64(defaultCtx, 424242) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 114 | if err != nil { |
| 115 | t.Fatalf("Unexpected error in TestI64() call: ", err) |
| 116 | } |
| 117 | if i64 != 424242 { |
| 118 | t.Fatalf("Unexpected TestI64() result expected 424242, got %d ", i64) |
| 119 | } |
| 120 | |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 121 | d, err := client.TestDouble(defaultCtx, 42.42) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 122 | if err != nil { |
| 123 | t.Fatalf("Unexpected error in TestDouble() call: ", err) |
| 124 | } |
| 125 | if d != 42.42 { |
| 126 | t.Fatalf("Unexpected TestDouble() result expected 42.42, got %f ", d) |
| 127 | } |
| 128 | |
Nobuaki Sukegawa | 9b35a7c | 2015-11-17 11:01:41 +0900 | [diff] [blame] | 129 | binout := make([]byte, 256) |
| 130 | for i := 0; i < 256; i++ { |
| 131 | binout[i] = byte(i) |
| 132 | } |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 133 | bin, err := client.TestBinary(defaultCtx, binout) |
Nobuaki Sukegawa | 9b35a7c | 2015-11-17 11:01:41 +0900 | [diff] [blame] | 134 | for i := 0; i < 256; i++ { |
D. Can Celasun | 4f77ab8 | 2017-09-21 15:21:00 +0200 | [diff] [blame] | 135 | if binout[i] != bin[i] { |
Nobuaki Sukegawa | 9b35a7c | 2015-11-17 11:01:41 +0900 | [diff] [blame] | 136 | t.Fatalf("Unexpected TestBinary() result expected %d, got %d ", binout[i], bin[i]) |
| 137 | } |
| 138 | } |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 139 | |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 140 | xs := thrifttest.NewXtruct() |
| 141 | xs.StringThing = "thing" |
| 142 | xs.ByteThing = 42 |
| 143 | xs.I32Thing = 4242 |
| 144 | xs.I64Thing = 424242 |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 145 | xsret, err := client.TestStruct(defaultCtx, xs) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 146 | if err != nil { |
| 147 | t.Fatalf("Unexpected error in TestStruct() call: ", err) |
| 148 | } |
| 149 | if *xs != *xsret { |
| 150 | t.Fatalf("Unexpected TestStruct() result expected %#v, got %#v ", xs, xsret) |
| 151 | } |
| 152 | |
| 153 | x2 := thrifttest.NewXtruct2() |
| 154 | x2.StructThing = xs |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 155 | x2ret, err := client.TestNest(defaultCtx, x2) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 156 | if err != nil { |
| 157 | t.Fatalf("Unexpected error in TestNest() call: ", err) |
| 158 | } |
| 159 | if !reflect.DeepEqual(x2, x2ret) { |
| 160 | t.Fatalf("Unexpected TestNest() result expected %#v, got %#v ", x2, x2ret) |
| 161 | } |
| 162 | |
| 163 | m := map[int32]int32{1: 2, 3: 4, 5: 42} |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 164 | mret, err := client.TestMap(defaultCtx, m) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 165 | if err != nil { |
| 166 | t.Fatalf("Unexpected error in TestMap() call: ", err) |
| 167 | } |
| 168 | if !reflect.DeepEqual(m, mret) { |
| 169 | t.Fatalf("Unexpected TestMap() result expected %#v, got %#v ", m, mret) |
| 170 | } |
| 171 | |
| 172 | sm := map[string]string{"a": "2", "b": "blah", "some": "thing"} |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 173 | smret, err := client.TestStringMap(defaultCtx, sm) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 174 | if err != nil { |
| 175 | t.Fatalf("Unexpected error in TestStringMap() call: ", err) |
| 176 | } |
| 177 | if !reflect.DeepEqual(sm, smret) { |
| 178 | t.Fatalf("Unexpected TestStringMap() result expected %#v, got %#v ", sm, smret) |
| 179 | } |
| 180 | |
D. Can Celasun | 43fb34d | 2017-01-15 10:53:19 +0100 | [diff] [blame] | 181 | s := []int32{1, 2, 42} |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 182 | sret, err := client.TestSet(defaultCtx, s) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 183 | if err != nil { |
| 184 | t.Fatalf("Unexpected error in TestSet() call: ", err) |
| 185 | } |
D. Can Celasun | 43fb34d | 2017-01-15 10:53:19 +0100 | [diff] [blame] | 186 | // Sets can be in any order, but Go slices are ordered, so reflect.DeepEqual won't work. |
| 187 | stemp := map[int32]struct{}{} |
| 188 | for _, val := range s { |
| 189 | stemp[val] = struct{}{} |
| 190 | } |
| 191 | for _, val := range sret { |
| 192 | if _, ok := stemp[val]; !ok { |
| 193 | t.Fatalf("Unexpected TestSet() result expected %#v, got %#v ", s, sret) |
| 194 | } |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 195 | } |
| 196 | |
| 197 | l := []int32{1, 2, 42} |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 198 | lret, err := client.TestList(defaultCtx, l) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 199 | if err != nil { |
| 200 | t.Fatalf("Unexpected error in TestList() call: ", err) |
| 201 | } |
| 202 | if !reflect.DeepEqual(l, lret) { |
D. Can Celasun | 43fb34d | 2017-01-15 10:53:19 +0100 | [diff] [blame] | 203 | t.Fatalf("Unexpected TestList() result expected %#v, got %#v ", l, lret) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 204 | } |
| 205 | |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 206 | eret, err := client.TestEnum(defaultCtx, thrifttest.Numberz_TWO) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 207 | if err != nil { |
| 208 | t.Fatalf("Unexpected error in TestEnum() call: ", err) |
| 209 | } |
| 210 | if eret != thrifttest.Numberz_TWO { |
| 211 | t.Fatalf("Unexpected TestEnum() result expected %#v, got %#v ", thrifttest.Numberz_TWO, eret) |
| 212 | } |
| 213 | |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 214 | tret, err := client.TestTypedef(defaultCtx, thrifttest.UserId(42)) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 215 | if err != nil { |
| 216 | t.Fatalf("Unexpected error in TestTypedef() call: ", err) |
| 217 | } |
| 218 | if tret != thrifttest.UserId(42) { |
| 219 | t.Fatalf("Unexpected TestTypedef() result expected %#v, got %#v ", thrifttest.UserId(42), tret) |
| 220 | } |
| 221 | |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 222 | mapmap, err := client.TestMapMap(defaultCtx, 42) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 223 | if err != nil { |
Nobuaki Sukegawa | a649e74 | 2015-09-21 13:53:25 +0900 | [diff] [blame] | 224 | t.Fatalf("Unexpected error in TestMapMap() call: ", err) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 225 | } |
| 226 | if !reflect.DeepEqual(mapmap, rmapmap) { |
Nobuaki Sukegawa | a649e74 | 2015-09-21 13:53:25 +0900 | [diff] [blame] | 227 | t.Fatalf("Unexpected TestMapMap() result expected %#v, got %#v ", rmapmap, mapmap) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 228 | } |
| 229 | |
Nobuaki Sukegawa | 2fab3de | 2015-08-16 15:42:58 +0900 | [diff] [blame] | 230 | crazy := thrifttest.NewInsanity() |
D. Can Celasun | 4f77ab8 | 2017-09-21 15:21:00 +0200 | [diff] [blame] | 231 | crazy.UserMap = map[thrifttest.Numberz]thrifttest.UserId{ |
| 232 | thrifttest.Numberz_FIVE: 5, |
Nobuaki Sukegawa | 2fab3de | 2015-08-16 15:42:58 +0900 | [diff] [blame] | 233 | thrifttest.Numberz_EIGHT: 8, |
| 234 | } |
| 235 | truck1 := thrifttest.NewXtruct() |
| 236 | truck1.StringThing = "Goodbye4" |
D. Can Celasun | 4f77ab8 | 2017-09-21 15:21:00 +0200 | [diff] [blame] | 237 | truck1.ByteThing = 4 |
| 238 | truck1.I32Thing = 4 |
| 239 | truck1.I64Thing = 4 |
Nobuaki Sukegawa | 2fab3de | 2015-08-16 15:42:58 +0900 | [diff] [blame] | 240 | truck2 := thrifttest.NewXtruct() |
| 241 | truck2.StringThing = "Hello2" |
D. Can Celasun | 4f77ab8 | 2017-09-21 15:21:00 +0200 | [diff] [blame] | 242 | truck2.ByteThing = 2 |
| 243 | truck2.I32Thing = 2 |
| 244 | truck2.I64Thing = 2 |
| 245 | crazy.Xtructs = []*thrifttest.Xtruct{ |
Nobuaki Sukegawa | 2fab3de | 2015-08-16 15:42:58 +0900 | [diff] [blame] | 246 | truck1, |
| 247 | truck2, |
| 248 | } |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 249 | insanity, err := client.TestInsanity(defaultCtx, crazy) |
Nobuaki Sukegawa | 2fab3de | 2015-08-16 15:42:58 +0900 | [diff] [blame] | 250 | if err != nil { |
| 251 | t.Fatalf("Unexpected error in TestInsanity() call: ", err) |
| 252 | } |
| 253 | if !reflect.DeepEqual(crazy, insanity[1][2]) { |
| 254 | t.Fatalf("Unexpected TestInsanity() first result expected %#v, got %#v ", |
D. Can Celasun | 4f77ab8 | 2017-09-21 15:21:00 +0200 | [diff] [blame] | 255 | crazy, |
| 256 | insanity[1][2]) |
Nobuaki Sukegawa | 2fab3de | 2015-08-16 15:42:58 +0900 | [diff] [blame] | 257 | } |
| 258 | if !reflect.DeepEqual(crazy, insanity[1][3]) { |
| 259 | t.Fatalf("Unexpected TestInsanity() second result expected %#v, got %#v ", |
D. Can Celasun | 4f77ab8 | 2017-09-21 15:21:00 +0200 | [diff] [blame] | 260 | crazy, |
| 261 | insanity[1][3]) |
Nobuaki Sukegawa | 2fab3de | 2015-08-16 15:42:58 +0900 | [diff] [blame] | 262 | } |
| 263 | if len(insanity[2][6].UserMap) > 0 || len(insanity[2][6].Xtructs) > 0 { |
| 264 | t.Fatalf("Unexpected TestInsanity() non-empty result got %#v ", |
D. Can Celasun | 4f77ab8 | 2017-09-21 15:21:00 +0200 | [diff] [blame] | 265 | insanity[2][6]) |
Nobuaki Sukegawa | 2fab3de | 2015-08-16 15:42:58 +0900 | [diff] [blame] | 266 | } |
| 267 | |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 268 | xxsret, err := client.TestMulti(defaultCtx, 42, 4242, 424242, map[int16]string{1: "blah", 2: "thing"}, thrifttest.Numberz_EIGHT, thrifttest.UserId(24)) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 269 | if err != nil { |
| 270 | t.Fatalf("Unexpected error in TestMulti() call: ", err) |
| 271 | } |
| 272 | if !reflect.DeepEqual(xxs, xxsret) { |
| 273 | t.Fatalf("Unexpected TestMulti() result expected %#v, got %#v ", xxs, xxsret) |
| 274 | } |
| 275 | |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 276 | err = client.TestException(defaultCtx, "Xception") |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 277 | if err == nil { |
| 278 | t.Fatalf("Expecting exception in TestException() call") |
| 279 | } |
| 280 | if !reflect.DeepEqual(err, xcept) { |
| 281 | t.Fatalf("Unexpected TestException() result expected %#v, got %#v ", xcept, err) |
| 282 | } |
| 283 | |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 284 | err = client.TestException(defaultCtx, "TException") |
Nobuaki Sukegawa | 2fab3de | 2015-08-16 15:42:58 +0900 | [diff] [blame] | 285 | _, ok := err.(thrift.TApplicationException) |
| 286 | if err == nil || !ok { |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 287 | t.Fatalf("Unexpected TestException() result expected ApplicationError, got %#v ", err) |
| 288 | } |
| 289 | |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 290 | ign, err := client.TestMultiException(defaultCtx, "Xception", "ignoreme") |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 291 | if ign != nil || err == nil { |
| 292 | t.Fatalf("Expecting exception in TestMultiException() call") |
| 293 | } |
| 294 | if !reflect.DeepEqual(err, &thrifttest.Xception{ErrorCode: 1001, Message: "This is an Xception"}) { |
| 295 | t.Fatalf("Unexpected TestMultiException() %#v ", err) |
| 296 | } |
| 297 | |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 298 | ign, err = client.TestMultiException(defaultCtx, "Xception2", "ignoreme") |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 299 | if ign != nil || err == nil { |
| 300 | t.Fatalf("Expecting exception in TestMultiException() call") |
| 301 | } |
| 302 | expecting := &thrifttest.Xception2{ErrorCode: 2002, StructThing: &thrifttest.Xtruct{StringThing: "This is an Xception2"}} |
| 303 | |
| 304 | if !reflect.DeepEqual(err, expecting) { |
| 305 | t.Fatalf("Unexpected TestMultiException() %#v ", err) |
| 306 | } |
| 307 | |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 308 | err = client.TestOneway(defaultCtx, 2) |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 309 | if err != nil { |
| 310 | t.Fatalf("Unexpected error in TestOneway() call: ", err) |
| 311 | } |
| 312 | |
| 313 | //Make sure the connection still alive |
taozle | 5c302e0 | 2017-07-23 15:21:44 +0200 | [diff] [blame] | 314 | if err = client.TestVoid(defaultCtx); err != nil { |
Jens Geyer | f459868 | 2014-05-08 23:18:44 +0200 | [diff] [blame] | 315 | t.Fatalf("Unexpected error in TestVoid() call: ", err) |
| 316 | } |
| 317 | } |