Skip to content

Commit 29f6657

Browse files
committed
modifying tests
1 parent efa8e5a commit 29f6657

1 file changed

Lines changed: 36 additions & 13 deletions

File tree

test/end2end_test.go

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3880,24 +3880,13 @@ func (s) TestServerStreaming_ClientSendsMultipleMessages(t *testing.T) {
38803880
}
38813881
}
38823882

3883-
// Tests the behavior for server-side streaming RPC when client sends zero request messages.
3884-
// Server runs against multiple StreamDesc configurations, including server-streaming,
3885-
// bidi-streaming and client-streaming.
3886-
func (s) TestServerStreaming_ClientSendsZeroRequests(t *testing.T) {
3883+
// Tests the behavior of server for server-side streaming RPC when client sends zero request messages.
3884+
func (s) TestServerStreaming_ServerRecvZeroRequests(t *testing.T) {
38873885
testCases := []struct {
38883886
name string
38893887
desc *grpc.StreamDesc
38903888
wantCode codes.Code
38913889
}{
3892-
{
3893-
name: "ServerStreaming",
3894-
desc: &grpc.StreamDesc{
3895-
StreamName: "StreamingOutputCall",
3896-
ServerStreams: true,
3897-
ClientStreams: false,
3898-
},
3899-
wantCode: codes.Internal,
3900-
},
39013890
{
39023891
name: "BidiStreaming",
39033892
desc: &grpc.StreamDesc{
@@ -3949,6 +3938,40 @@ func (s) TestServerStreaming_ClientSendsZeroRequests(t *testing.T) {
39493938
}
39503939
}
39513940

3941+
// Tests the behavior of client for server-side streaming RPC when client sends zero request messages.
3942+
func (s) TestServerStreaming_ClientSendsZeroRequests(t *testing.T) {
3943+
t.Skip()
3944+
// The initial call to recvMsg made by the generated code, will return the error.
3945+
ss := stubserver.StubServer{}
3946+
if err := ss.Start(nil); err != nil {
3947+
t.Fatal("Error starting server:", err)
3948+
}
3949+
defer ss.Stop()
3950+
3951+
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
3952+
defer cancel()
3953+
cc, err := grpc.NewClient(ss.Address, grpc.WithTransportCredentials(insecure.NewCredentials()))
3954+
if err != nil {
3955+
t.Fatalf("grpc.NewClient(%q) failed unexpectedly: %v", ss.Address, err)
3956+
}
3957+
defer cc.Close()
3958+
3959+
desc := &grpc.StreamDesc{
3960+
StreamName: "StreamingOutputCall",
3961+
ServerStreams: true,
3962+
ClientStreams: false,
3963+
}
3964+
3965+
stream, err := cc.NewStream(ctx, desc, "/grpc.testing.TestService/StreamingOutputCall")
3966+
if err != nil {
3967+
t.Fatalf("cc.NewStream() failed unexpectedly: %v", err)
3968+
}
3969+
3970+
if err := stream.CloseSend(); status.Code(err) != codes.Internal {
3971+
t.Errorf("stream.CloseSend() = %v, want error %v", status.Code(err), codes.Internal)
3972+
}
3973+
}
3974+
39523975
// Tests that a client receives a cardinality violation error for client-streaming
39533976
// RPCs if the server call SendMsg multiple times.
39543977
func (s) TestClientStreaming_ServerHandlerSendMsgAfterSendMsg(t *testing.T) {

0 commit comments

Comments
 (0)