THRIFT-4260 Go context generation issue. Context is parameter in Interface not in implementation
Client: Go
Patch: taozle <zhangliyang26@gmail.com>
This closes #1312
diff --git a/test/go/src/common/clientserver_test.go b/test/go/src/common/clientserver_test.go
index acc3dba..ecd021f 100644
--- a/test/go/src/common/clientserver_test.go
+++ b/test/go/src/common/clientserver_test.go
@@ -120,11 +120,11 @@
handler.EXPECT().TestVoid(gomock.Any()),
)
var err error
- if err = client.TestVoid(); err != nil {
+ if err = client.TestVoid(defaultCtx); err != nil {
t.Errorf("Unexpected error in TestVoid() call: ", err)
}
- thing, err := client.TestString("thing")
+ thing, err := client.TestString(defaultCtx, "thing")
if err != nil {
t.Errorf("Unexpected error in TestString() call: ", err)
}
@@ -132,14 +132,14 @@
t.Errorf("Unexpected TestString() result, expected 'thing' got '%s' ", thing)
}
- bl, err := client.TestBool(true)
+ bl, err := client.TestBool(defaultCtx, true)
if err != nil {
t.Errorf("Unexpected error in TestBool() call: ", err)
}
if !bl {
t.Errorf("Unexpected TestBool() result expected true, got %f ", bl)
}
- bl, err = client.TestBool(false)
+ bl, err = client.TestBool(defaultCtx, false)
if err != nil {
t.Errorf("Unexpected error in TestBool() call: ", err)
}
@@ -147,7 +147,7 @@
t.Errorf("Unexpected TestBool() result expected false, got %f ", bl)
}
- b, err := client.TestByte(42)
+ b, err := client.TestByte(defaultCtx, 42)
if err != nil {
t.Errorf("Unexpected error in TestByte() call: ", err)
}
@@ -155,7 +155,7 @@
t.Errorf("Unexpected TestByte() result expected 42, got %d ", b)
}
- i32, err := client.TestI32(4242)
+ i32, err := client.TestI32(defaultCtx, 4242)
if err != nil {
t.Errorf("Unexpected error in TestI32() call: ", err)
}
@@ -163,7 +163,7 @@
t.Errorf("Unexpected TestI32() result expected 4242, got %d ", i32)
}
- i64, err := client.TestI64(424242)
+ i64, err := client.TestI64(defaultCtx, 424242)
if err != nil {
t.Errorf("Unexpected error in TestI64() call: ", err)
}
@@ -171,7 +171,7 @@
t.Errorf("Unexpected TestI64() result expected 424242, got %d ", i64)
}
- d, err := client.TestDouble(42.42)
+ d, err := client.TestDouble(defaultCtx, 42.42)
if err != nil {
t.Errorf("Unexpected error in TestDouble() call: ", err)
}
@@ -186,7 +186,7 @@
xs.ByteThing = 42
xs.I32Thing = 4242
xs.I64Thing = 424242
- xsret, err := client.TestStruct(xs)
+ xsret, err := client.TestStruct(defaultCtx, xs)
if err != nil {
t.Errorf("Unexpected error in TestStruct() call: ", err)
}
@@ -196,7 +196,7 @@
x2 := thrifttest.NewXtruct2()
x2.StructThing = xs
- x2ret, err := client.TestNest(x2)
+ x2ret, err := client.TestNest(defaultCtx, x2)
if err != nil {
t.Errorf("Unexpected error in TestNest() call: ", err)
}
@@ -205,7 +205,7 @@
}
m := map[int32]int32{1: 2, 3: 4, 5: 42}
- mret, err := client.TestMap(m)
+ mret, err := client.TestMap(defaultCtx, m)
if err != nil {
t.Errorf("Unexpected error in TestMap() call: ", err)
}
@@ -214,7 +214,7 @@
}
sm := map[string]string{"a": "2", "b": "blah", "some": "thing"}
- smret, err := client.TestStringMap(sm)
+ smret, err := client.TestStringMap(defaultCtx, sm)
if err != nil {
t.Errorf("Unexpected error in TestStringMap() call: ", err)
}
@@ -223,7 +223,7 @@
}
s := []int32{1, 2, 42}
- sret, err := client.TestSet(s)
+ sret, err := client.TestSet(defaultCtx, s)
if err != nil {
t.Errorf("Unexpected error in TestSet() call: ", err)
}
@@ -239,7 +239,7 @@
}
l := []int32{1, 2, 42}
- lret, err := client.TestList(l)
+ lret, err := client.TestList(defaultCtx, l)
if err != nil {
t.Errorf("Unexpected error in TestList() call: ", err)
}
@@ -247,7 +247,7 @@
t.Errorf("Unexpected TestList() result expected %#v, got %#v ", l, lret)
}
- eret, err := client.TestEnum(thrifttest.Numberz_TWO)
+ eret, err := client.TestEnum(defaultCtx, thrifttest.Numberz_TWO)
if err != nil {
t.Errorf("Unexpected error in TestEnum() call: ", err)
}
@@ -255,7 +255,7 @@
t.Errorf("Unexpected TestEnum() result expected %#v, got %#v ", thrifttest.Numberz_TWO, eret)
}
- tret, err := client.TestTypedef(thrifttest.UserId(42))
+ tret, err := client.TestTypedef(defaultCtx, thrifttest.UserId(42))
if err != nil {
t.Errorf("Unexpected error in TestTypedef() call: ", err)
}
@@ -263,7 +263,7 @@
t.Errorf("Unexpected TestTypedef() result expected %#v, got %#v ", thrifttest.UserId(42), tret)
}
- mapmap, err := client.TestMapMap(42)
+ mapmap, err := client.TestMapMap(defaultCtx, 42)
if err != nil {
t.Errorf("Unexpected error in TestMapmap() call: ", err)
}
@@ -271,7 +271,7 @@
t.Errorf("Unexpected TestMapmap() result expected %#v, got %#v ", rmapmap, mapmap)
}
- xxsret, err := client.TestMulti(42, 4242, 424242, map[int16]string{1: "blah", 2: "thing"}, thrifttest.Numberz_EIGHT, thrifttest.UserId(24))
+ xxsret, err := client.TestMulti(defaultCtx, 42, 4242, 424242, map[int16]string{1: "blah", 2: "thing"}, thrifttest.Numberz_EIGHT, thrifttest.UserId(24))
if err != nil {
t.Errorf("Unexpected error in TestMulti() call: ", err)
}
@@ -279,7 +279,7 @@
t.Errorf("Unexpected TestMulti() result expected %#v, got %#v ", xxs, xxsret)
}
- err = client.TestException("some")
+ err = client.TestException(defaultCtx, "some")
if err == nil {
t.Errorf("Expecting exception in TestException() call")
}
@@ -288,13 +288,13 @@
}
// TODO: connection is being closed on this
- err = client.TestException("TException")
+ err = client.TestException(defaultCtx, "TException")
tex, ok := err.(thrift.TApplicationException)
if err == nil || !ok || tex.TypeId() != thrift.INTERNAL_ERROR {
t.Errorf("Unexpected TestException() result expected ApplicationError, got %#v ", err)
}
- ign, err := client.TestMultiException("Xception", "ignoreme")
+ ign, err := client.TestMultiException(defaultCtx, "Xception", "ignoreme")
if ign != nil || err == nil {
t.Errorf("Expecting exception in TestMultiException() call")
}
@@ -302,7 +302,7 @@
t.Errorf("Unexpected TestMultiException() %#v ", err)
}
- ign, err = client.TestMultiException("Xception2", "ignoreme")
+ ign, err = client.TestMultiException(defaultCtx, "Xception2", "ignoreme")
if ign != nil || err == nil {
t.Errorf("Expecting exception in TestMultiException() call")
}
@@ -312,13 +312,13 @@
t.Errorf("Unexpected TestMultiException() %#v ", err)
}
- err = client.TestOneway(2)
+ err = client.TestOneway(defaultCtx, 2)
if err != nil {
t.Errorf("Unexpected error in TestOneway() call: ", err)
}
//Make sure the connection still alive
- if err = client.TestVoid(); err != nil {
+ if err = client.TestVoid(defaultCtx); err != nil {
t.Errorf("Unexpected error in TestVoid() call: ", err)
}
}