MCPcopy
hub / github.com/grpc/grpc-go / performOneRPC

Function performOneRPC

internal/transport/transport_test.go:829–852  ·  view source on GitHub ↗
(ct ClientTransport)

Source from the content-addressed store, hash-verified

827}
828
829func performOneRPC(ct ClientTransport) {
830 callHdr := &CallHdr{
831 Host: "localhost",
832 Method: "foo.Small",
833 }
834 ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
835 defer cancel()
836 s, err := ct.NewStream(ctx, callHdr, nil)
837 if err != nil {
838 return
839 }
840 opts := WriteOptions{Last: true}
841 if err := s.Write([]byte{}, newBufferSlice(expectedRequest), &opts); err == nil || err == io.EOF {
842 time.Sleep(5 * time.Millisecond)
843 // The following s.Recv()'s could error out because the
844 // underlying transport is gone.
845 //
846 // Read response
847 p := make([]byte, len(expectedResponse))
848 s.readTo(p)
849 // Read io.EOF
850 s.readTo(p)
851 }
852}
853
854func (s) TestClientMix(t *testing.T) {
855 s, ct, cancel := setUp(t, 0, normal)

Callers 1

TestClientMixMethod · 0.85

Calls 4

readToMethod · 0.95
newBufferSliceFunction · 0.85
NewStreamMethod · 0.65
WriteMethod · 0.65

Tested by

no test coverage detected