From f5664d33fb5f89118c10cc9d1c198b5bdc106687 Mon Sep 17 00:00:00 2001 From: godcong Date: Fri, 4 Feb 2022 00:43:28 +0800 Subject: [PATCH] fix go_test implement error (#7012) * fix(grpc): fix go_test implement error * fix(grpc): fix go_test implement error --- grpc/tests/go_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/grpc/tests/go_test.go b/grpc/tests/go_test.go index 260e236a9..7c94feb8f 100644 --- a/grpc/tests/go_test.go +++ b/grpc/tests/go_test.go @@ -1,8 +1,8 @@ package testing import ( - "../../tests/MyGame/Example" flatbuffers "github.com/google/flatbuffers/go" + "github.com/google/flatbuffers/tests/MyGame/Example" "context" "net" @@ -12,7 +12,9 @@ import ( "google.golang.org/grpc/encoding" ) -type server struct{} +type server struct { + Example.UnimplementedMonsterStorageServer +} // test used to send and receive in grpc methods var test = "Flatbuffers" @@ -65,8 +67,12 @@ func RetrieveClient(c Example.MonsterStorageClient, t *testing.T) { if err != nil { t.Fatalf("Retrieve client failed: %v", err) } - if string(out.Name()) != test { - t.Errorf("RetrieveClient failed: expected=%s, got=%s\n", test, out.Name()) + monster, err := out.Recv() + if err != nil { + t.Fatalf("Recv failed: %v", err) + } + if string(monster.Name()) != test { + t.Errorf("RetrieveClient failed: expected=%s, got=%s\n", test, monster.Name()) t.Fail() } }