Repository: thrift Updated Branches: refs/heads/master 738143cf3 -> 2fab3deb0
THRIFT-3296 - Go cross test does not conform to spec Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/2fab3deb Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/2fab3deb Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/2fab3deb Branch: refs/heads/master Commit: 2fab3deb09e492cbcb2b1e4ed1c1d302787a9abd Parents: 738143c Author: Nobuaki Sukegawa <[email protected]> Authored: Sun Aug 16 15:42:58 2015 +0900 Committer: Henrique Mendonça <[email protected]> Committed: Mon Aug 17 21:54:23 2015 +1000 ---------------------------------------------------------------------- .gitignore | 1 + test/go/src/bin/testclient/main.go | 43 ++++++++++++++++-- test/go/src/common/clientserver_test.go | 2 +- test/go/src/common/printing_handler.go | 11 ++++- test/known_failures_Linux.json | 68 ---------------------------- 5 files changed, 52 insertions(+), 73 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/2fab3deb/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore index 013dc9e..8c5376d 100644 --- a/.gitignore +++ b/.gitignore @@ -241,6 +241,7 @@ test-driver /test/go/ThriftTest.thrift /test/go/gopath /test/go/pkg/ +/test/go/src/code.google.com/ /test/go/src/github.com/golang/ /test/go/src/gen/ /test/go/src/thrift http://git-wip-us.apache.org/repos/asf/thrift/blob/2fab3deb/test/go/src/bin/testclient/main.go ---------------------------------------------------------------------- diff --git a/test/go/src/bin/testclient/main.go b/test/go/src/bin/testclient/main.go index 94b5c61..f19743a 100644 --- a/test/go/src/bin/testclient/main.go +++ b/test/go/src/bin/testclient/main.go @@ -192,6 +192,44 @@ func callEverything(client *thrifttest.ThriftTestClient) { t.Fatalf("Unexpected TestMapmap() result expected %#v, got %#v ", rmapmap, mapmap) } + crazy := thrifttest.NewInsanity() + crazy.UserMap = map[thrifttest.Numberz]thrifttest.UserId { + thrifttest.Numberz_FIVE: 5, + thrifttest.Numberz_EIGHT: 8, + } + truck1 := thrifttest.NewXtruct() + truck1.StringThing = "Goodbye4" + truck1.ByteThing = 4; + truck1.I32Thing = 4; + truck1.I64Thing = 4; + truck2 := thrifttest.NewXtruct() + truck2.StringThing = "Hello2" + truck2.ByteThing = 2; + truck2.I32Thing = 2; + truck2.I64Thing = 2; + crazy.Xtructs = []*thrifttest.Xtruct { + truck1, + truck2, + } + insanity, err := client.TestInsanity(crazy) + if err != nil { + t.Fatalf("Unexpected error in TestInsanity() call: ", err) + } + if !reflect.DeepEqual(crazy, insanity[1][2]) { + t.Fatalf("Unexpected TestInsanity() first result expected %#v, got %#v ", + crazy, + insanity[1][2]) + } + if !reflect.DeepEqual(crazy, insanity[1][3]) { + t.Fatalf("Unexpected TestInsanity() second result expected %#v, got %#v ", + crazy, + insanity[1][3]) + } + if len(insanity[2][6].UserMap) > 0 || len(insanity[2][6].Xtructs) > 0 { + t.Fatalf("Unexpected TestInsanity() non-empty result got %#v ", + insanity[2][6]) + } + xxsret, err := client.TestMulti(42, 4242, 424242, map[int16]string{1: "blah", 2: "thing"}, thrifttest.Numberz_EIGHT, thrifttest.UserId(24)) if err != nil { t.Fatalf("Unexpected error in TestMulti() call: ", err) @@ -208,10 +246,9 @@ func callEverything(client *thrifttest.ThriftTestClient) { t.Fatalf("Unexpected TestException() result expected %#v, got %#v ", xcept, err) } - // TODO: connection is being closed on this err = client.TestException("TException") - tex, ok := err.(thrift.TApplicationException) - if err == nil || !ok || tex.TypeId() != thrift.INTERNAL_ERROR { + _, ok := err.(thrift.TApplicationException) + if err == nil || !ok { t.Fatalf("Unexpected TestException() result expected ApplicationError, got %#v ", err) } http://git-wip-us.apache.org/repos/asf/thrift/blob/2fab3deb/test/go/src/common/clientserver_test.go ---------------------------------------------------------------------- diff --git a/test/go/src/common/clientserver_test.go b/test/go/src/common/clientserver_test.go index 0080ead..a7bd46c 100644 --- a/test/go/src/common/clientserver_test.go +++ b/test/go/src/common/clientserver_test.go @@ -103,7 +103,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h handler.EXPECT().TestEnum(thrifttest.Numberz_TWO).Return(thrifttest.Numberz_TWO, nil), handler.EXPECT().TestTypedef(thrifttest.UserId(42)).Return(thrifttest.UserId(42), nil), handler.EXPECT().TestMapMap(int32(42)).Return(rmapmap, nil), - //not testing insanity + // TODO: not testing insanity handler.EXPECT().TestMulti(int8(42), int32(4242), int64(424242), map[int16]string{1: "blah", 2: "thing"}, thrifttest.Numberz_EIGHT, thrifttest.UserId(24)).Return(xxs, nil), handler.EXPECT().TestException("some").Return(xcept), handler.EXPECT().TestException("TException").Return(errors.New("Just random exception")), http://git-wip-us.apache.org/repos/asf/thrift/blob/2fab3deb/test/go/src/common/printing_handler.go ---------------------------------------------------------------------- diff --git a/test/go/src/common/printing_handler.go b/test/go/src/common/printing_handler.go index bed7086..8c902d1 100644 --- a/test/go/src/common/printing_handler.go +++ b/test/go/src/common/printing_handler.go @@ -263,7 +263,16 @@ func (p *printingHandler) TestMapMap(hello int32) (r map[int32]map[int32]int32, // Parameters: // - Argument func (p *printingHandler) TestInsanity(argument *Insanity) (r map[UserId]map[Numberz]*Insanity, err error) { - return nil, errors.New("No Insanity") + fmt.Printf("testInsanity()\n") + r = make(map[UserId]map[Numberz]*Insanity) + r[1] = map[Numberz]*Insanity { + 2: argument, + 3: argument, + } + r[2] = map[Numberz]*Insanity { + 6: NewInsanity(), + } + return } // Prints 'testMulti()' http://git-wip-us.apache.org/repos/asf/thrift/blob/2fab3deb/test/known_failures_Linux.json ---------------------------------------------------------------------- diff --git a/test/known_failures_Linux.json b/test/known_failures_Linux.json index 416a53d..eef9f46 100644 --- a/test/known_failures_Linux.json +++ b/test/known_failures_Linux.json @@ -1,8 +1,6 @@ [ "c_glib-csharp_binary_buffered-ip", "c_glib-csharp_binary_framed-ip", - "c_glib-go_binary_buffered-ip", - "c_glib-go_binary_framed-ip", "c_glib-hs_binary_framed-ip", "c_glib-nodejs_binary_buffered-ip", "c_glib-nodejs_binary_framed-ip", @@ -26,18 +24,6 @@ "cpp-csharp_compact_framed-ip-ssl", "cpp-csharp_json_buffered-ip-ssl", "cpp-csharp_json_framed-ip-ssl", - "cpp-go_binary_buffered-ip", - "cpp-go_binary_buffered-ip-ssl", - "cpp-go_binary_framed-ip", - "cpp-go_binary_framed-ip-ssl", - "cpp-go_compact_buffered-ip", - "cpp-go_compact_buffered-ip-ssl", - "cpp-go_compact_framed-ip", - "cpp-go_compact_framed-ip-ssl", - "cpp-go_json_buffered-ip", - "cpp-go_json_buffered-ip-ssl", - "cpp-go_json_framed-ip", - "cpp-go_json_framed-ip-ssl", "cpp-hs_binary_buffered-ip-ssl", "cpp-hs_binary_framed-ip", "cpp-hs_binary_framed-ip-ssl", @@ -165,29 +151,11 @@ "csharp-rb_json_framed-ip", "go-c_glib_binary_buffered-ip", "go-c_glib_binary_framed-ip", - "go-cpp_binary_buffered-ip", - "go-cpp_binary_buffered-ip-ssl", - "go-cpp_binary_framed-ip", - "go-cpp_binary_framed-ip-ssl", - "go-cpp_compact_buffered-ip", - "go-cpp_compact_buffered-ip-ssl", - "go-cpp_compact_framed-ip", - "go-cpp_compact_framed-ip-ssl", - "go-cpp_json_buffered-ip", - "go-cpp_json_buffered-ip-ssl", - "go-cpp_json_framed-ip", - "go-cpp_json_framed-ip-ssl", - "go-csharp_binary_buffered-ip", "go-csharp_binary_buffered-ip-ssl", - "go-csharp_binary_framed-ip", "go-csharp_binary_framed-ip-ssl", - "go-csharp_compact_buffered-ip", "go-csharp_compact_buffered-ip-ssl", - "go-csharp_compact_framed-ip", "go-csharp_compact_framed-ip-ssl", - "go-csharp_json_buffered-ip", "go-csharp_json_buffered-ip-ssl", - "go-csharp_json_framed-ip", "go-csharp_json_framed-ip-ssl", "go-hs_binary_buffered-ip-ssl", "go-hs_binary_framed-ip", @@ -198,24 +166,6 @@ "go-hs_json_buffered-ip-ssl", "go-hs_json_framed-ip", "go-hs_json_framed-ip-ssl", - "go-java_binary_buffered-ip", - "go-java_binary_buffered-ip-ssl", - "go-java_binary_framed-fastframed-ip", - "go-java_binary_framed-fastframed-ip-ssl", - "go-java_binary_framed-ip", - "go-java_binary_framed-ip-ssl", - "go-java_compact_buffered-ip", - "go-java_compact_buffered-ip-ssl", - "go-java_compact_framed-fastframed-ip", - "go-java_compact_framed-fastframed-ip-ssl", - "go-java_compact_framed-ip", - "go-java_compact_framed-ip-ssl", - "go-java_json_buffered-ip", - "go-java_json_buffered-ip-ssl", - "go-java_json_framed-fastframed-ip", - "go-java_json_framed-fastframed-ip-ssl", - "go-java_json_framed-ip", - "go-java_json_framed-ip-ssl", "go-nodejs_binary_buffered-ip", "go-nodejs_binary_buffered-ip-ssl", "go-nodejs_binary_framed-ip", @@ -228,14 +178,8 @@ "go-nodejs_json_buffered-ip-ssl", "go-nodejs_json_framed-ip", "go-nodejs_json_framed-ip-ssl", - "go-perl_binary_buffered-ip", "go-perl_binary_buffered-ip-ssl", - "go-perl_binary_framed-ip", "go-perl_binary_framed-ip-ssl", - "go-php_binary_buffered-ip", - "go-php_binary_framed-ip", - "go-php_compact_buffered-ip", - "go-php_compact_framed-ip", "go-py_json_buffered-ip", "go-py_json_buffered-ip-ssl", "go-py_json_framed-ip", @@ -404,18 +348,6 @@ "nodejs-csharp_json_buffered-ip-ssl", "nodejs-csharp_json_framed-ip", "nodejs-csharp_json_framed-ip-ssl", - "nodejs-go_binary_buffered-ip", - "nodejs-go_binary_buffered-ip-ssl", - "nodejs-go_binary_framed-ip", - "nodejs-go_binary_framed-ip-ssl", - "nodejs-go_compact_buffered-ip", - "nodejs-go_compact_buffered-ip-ssl", - "nodejs-go_compact_framed-ip", - "nodejs-go_compact_framed-ip-ssl", - "nodejs-go_json_buffered-ip", - "nodejs-go_json_buffered-ip-ssl", - "nodejs-go_json_framed-ip", - "nodejs-go_json_framed-ip-ssl", "nodejs-hs_binary_buffered-ip-ssl", "nodejs-hs_binary_framed-ip", "nodejs-hs_binary_framed-ip-ssl",
