add grpc streaming test

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-09-20 14:15:26 +03:00
parent fb33535995
commit 78c4a8e9ff

View File

@ -177,7 +177,13 @@ func TestGRPCClient(t *testing.T) {
for i := 0; i < 5; i++ { for i := 0; i < 5; i++ {
fmt.Printf("recv from stream\n") fmt.Printf("recv from stream\n")
if err = stream.Recv(rsp); err != nil { if err = stream.Recv(rsp); err != nil {
t.Fatal(err) st, ok := status.FromError(err)
if !ok {
t.Fatalf("%v", err)
}
if st.Code() != codes.DeadlineExceeded {
t.Fatalf("%v", err)
}
} }
if rsp.Msg != "test name" { if rsp.Msg != "test name" {
t.Fatalf("invalid msg: %v", rsp) t.Fatalf("invalid msg: %v", rsp)