Skip to content

Commit 749a52c

Browse files
committed
resolving comments
1 parent 183b1da commit 749a52c

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

test/end2end_test.go

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3741,13 +3741,9 @@ func (s) TestClientStreaming_ReturnErrorAfterSendAndClose(t *testing.T) {
37413741
}
37423742
}
37433743

3744-
// Tests the behavior for server-side streaming RPCs when client calls SendMsg twice.
3745-
// The first client.SendMsg() sends EOF along with the message. When client calls a
3746-
// second SendMsg, it triggers a RST_STREAM which cancels the stream context on the
3747-
// server. There would be a race, the RST_STREAM could cause the server’s first RecvMsg
3748-
// to fail, even if the request message was already delivered. By synchronizing, we
3749-
// ensure that the server has read the first message before the client triggers RST_STREAM
3750-
// and validating expected error codes.
3744+
// Tests the behavior for server-side streaming when client calls SendMsg twice.
3745+
// Second call to SendMsg should fail with Internal error and result in closing
3746+
// the connection with a RST_STREAM.
37513747
func (s) TestServerStreaming_ClientCallSendMsgTwice(t *testing.T) {
37523748
// To ensure server.recvMsg() is successfully completed.
37533749
recvDoneOnServer := make(chan struct{})
@@ -3756,8 +3752,9 @@ func (s) TestServerStreaming_ClientCallSendMsgTwice(t *testing.T) {
37563752
handlerDone := make(chan struct{})
37573753
ss := stubserver.StubServer{
37583754
StreamingOutputCallF: func(_ *testpb.StreamingOutputCallRequest, stream testgrpc.TestService_StreamingOutputCallServer) error {
3759-
// The initial call to recvMsg is made by the generated code.
3755+
// The initial call to recvMsg is made by the generated code. Signal test when done.
37603756
close(recvDoneOnServer)
3757+
// Block until the stream’s context is done (cancelled by client).
37613758
<-stream.Context().Done()
37623759
if err := stream.SendMsg(&testpb.StreamingOutputCallRequest{}); status.Code(err) != codes.Canceled {
37633760
t.Errorf("stream.SendMsg() = %v, want error %v", err, codes.Canceled)
@@ -3790,18 +3787,20 @@ func (s) TestServerStreaming_ClientCallSendMsgTwice(t *testing.T) {
37903787
t.Fatalf("cc.NewStream() failed unexpectedly: %v", err)
37913788
}
37923789

3790+
// First SendMsg sends EOF along with the message.
37933791
if err := stream.SendMsg(&testpb.Empty{}); err != nil {
37943792
t.Errorf("stream.SendMsg() = %v, want <nil>", err)
37953793
}
3794+
3795+
// To ensure that the server has read the first message before client triggers RST_STREAM.
37963796
<-recvDoneOnServer
37973797
if err := stream.SendMsg(&testpb.Empty{}); status.Code(err) != codes.Internal {
37983798
t.Errorf("stream.SendMsg() = %v, want error %v", err, codes.Internal)
37993799
}
38003800
<-handlerDone
38013801
}
38023802

3803-
// TODO : https://github.com/grpc/grpc-go/issues/7286 - Add tests to check
3804-
// server-side behavior for Unary RPC.
3803+
// TODO(i/7286) : Add tests to check server-side behavior for Unary RPC.
38053804
// Tests the behavior for unary RPC when client calls SendMsg twice. Second call
38063805
// to SendMsg should fail with Internal error.
38073806
func (s) TestUnaryRPC_ClientCallSendMsgTwice(t *testing.T) {
@@ -3947,9 +3946,7 @@ func (s) TestServerStreaming_ServerRecvZeroRequests(t *testing.T) {
39473946

39483947
// Tests the behavior of client for server-side streaming RPC when client sends zero request messages.
39493948
func (s) TestServerStreaming_ClientSendsZeroRequests(t *testing.T) {
3950-
// TODO : https://github.com/grpc/grpc-go/issues/7286 - remove `t.Skip()`
3951-
// after this is fixed.
3952-
t.Skip()
3949+
t.Skip("blocked on i/7286")
39533950
// The initial call to recvMsg made by the generated code, will return the error.
39543951
ss := stubserver.StubServer{}
39553952
if err := ss.Start(nil); err != nil {

0 commit comments

Comments
 (0)