This func is to be used to test client side counting of failed streams.
(tc testgrpc.TestServiceClient, t *testing.T, l *listenerWrapper)
| 874 | |
| 875 | // This func is to be used to test client side counting of failed streams. |
| 876 | func doServerSideInitiatedFailedStreamWithRSTStream(tc testgrpc.TestServiceClient, t *testing.T, l *listenerWrapper) { |
| 877 | ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) |
| 878 | defer cancel() |
| 879 | stream, err := tc.FullDuplexCall(ctx) |
| 880 | if err != nil { |
| 881 | t.Fatalf("TestService/FullDuplexCall(_) = _, %v, want <nil>", err) |
| 882 | } |
| 883 | |
| 884 | const smallSize = 1 |
| 885 | smallPayload, err := newPayload(testpb.PayloadType_COMPRESSABLE, smallSize) |
| 886 | if err != nil { |
| 887 | t.Fatal(err) |
| 888 | } |
| 889 | |
| 890 | sreq := &testpb.StreamingOutputCallRequest{ |
| 891 | ResponseType: testpb.PayloadType_COMPRESSABLE, |
| 892 | ResponseParameters: []*testpb.ResponseParameters{ |
| 893 | {Size: smallSize}, |
| 894 | }, |
| 895 | Payload: smallPayload, |
| 896 | } |
| 897 | |
| 898 | if err := stream.Send(sreq); err != nil { |
| 899 | t.Fatalf("%v.Send(%v) = %v, want <nil>", stream, sreq, err) |
| 900 | } |
| 901 | if _, err := stream.Recv(); err != nil { |
| 902 | t.Fatalf("%v.Recv() = %v, want <nil>", stream, err) |
| 903 | } |
| 904 | |
| 905 | rcw := l.getLastConn() |
| 906 | |
| 907 | if rcw != nil { |
| 908 | rcw.writeRSTStream(tc.(*testServiceClientWrapper).getCurrentStreamID(), http2.ErrCodeCancel) |
| 909 | } |
| 910 | if _, err := stream.Recv(); err == nil { |
| 911 | t.Fatalf("%v.Recv() = %v, want <non-nil>", stream, err) |
| 912 | } |
| 913 | } |
| 914 | |
| 915 | // this func is to be used to test client side counting of failed streams. |
| 916 | func doServerSideInitiatedFailedStreamWithGoAway(ctx context.Context, tc testgrpc.TestServiceClient, t *testing.T, l *listenerWrapper) { |
no test coverage detected