Skip to content

Commit

Permalink
Rename client stream method
Browse files Browse the repository at this point in the history
  • Loading branch information
Ormin committed Oct 28, 2024
1 parent 776bfe9 commit 85459da
Show file tree
Hide file tree
Showing 5 changed files with 218 additions and 88 deletions.
6 changes: 3 additions & 3 deletions interceptors/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,22 +340,22 @@ func (s *ClientInterceptorTestSuite) TestBiStreamingReporting() {


func (s *ClientInterceptorTestSuite) TestClientStream() {
ss, err := s.testClient.PingStreamSingleResponse(s.ctx)
ss, err := s.testClient.PingClientStream(s.ctx)
require.NoError(s.T(), err)

defer func() {
_, _ = ss.CloseAndRecv()
}()

for i := 0; i < 100; i++ {
require.NoError(s.T(), ss.Send(&testpb.PingStreamRequest{}), "sending shouldn't fail")
require.NoError(s.T(), ss.Send(&testpb.PingClientStreamRequest{}), "sending shouldn't fail")
}

_, err = ss.CloseAndRecv()
require.NoError(s.T(), err)

s.mock.Equal(s.T(), []*mockReport{{
CallMeta: CallMeta{Typ: ClientStream, Service: testpb.TestServiceFullName, Method: "PingStreamSingleResponse"},
CallMeta: CallMeta{Typ: ClientStream, Service: testpb.TestServiceFullName, Method: "PingClientStream"},
postCalls: []error{nil},
postMsgReceives: []error{nil},
postMsgSends: make([]error, 100),
Expand Down
4 changes: 2 additions & 2 deletions testing/testpb/pingservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (s *TestPingService) PingStream(stream TestService_PingStreamServer) error
}


func (s *TestPingService) PingStreamSingleResponse(stream TestService_PingStreamSingleResponseServer) error {
func (s *TestPingService) PingClientStream(stream TestService_PingClientStreamServer) error {
count := 0
for {
_, err := stream.Recv()
Expand All @@ -94,5 +94,5 @@ func (s *TestPingService) PingStreamSingleResponse(stream TestService_PingStream
}
count += 1
}
return stream.SendAndClose(&PingStreamResponse{Value: "single", Counter: int32(count)})
return stream.SendAndClose(&PingClientStreamResponse{Counter: int32(count)})
}
246 changes: 183 additions & 63 deletions testing/testpb/test.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 85459da

Please sign in to comment.