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

Method TestStreamingServerInterceptorGetsConnection

test/end2end_test.go:6680–6697  ·  view source on GitHub ↗

TestStreamingServerInterceptorGetsConnection tests whether the accepted conn on the server gets to any streaming interceptors on the server side.

(t *testing.T)

Source from the content-addressed store, hash-verified

6678// TestStreamingServerInterceptorGetsConnection tests whether the accepted conn on
6679// the server gets to any streaming interceptors on the server side.
6680func (s) TestStreamingServerInterceptorGetsConnection(t *testing.T) {
6681 ss := &stubserver.StubServer{}
6682 if err := ss.Start([]grpc.ServerOption{grpc.StreamInterceptor(streamingInterceptorVerifyConn)}); err != nil {
6683 t.Fatalf("Error starting endpoint server: %v", err)
6684 }
6685 defer ss.Stop()
6686
6687 ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
6688 defer cancel()
6689
6690 s, err := ss.Client.StreamingOutputCall(ctx, &testpb.StreamingOutputCallRequest{})
6691 if err != nil {
6692 t.Fatalf("ss.Client.StreamingOutputCall(_) = _, %v, want _, <nil>", err)
6693 }
6694 if _, err := s.Recv(); err != io.EOF {
6695 t.Fatalf("ss.Client.StreamingInputCall(_) = _, %v, want _, %v", err, io.EOF)
6696 }
6697}
6698
6699// unaryInterceptorVerifyAuthority verifies there is an unambiguous :authority
6700// once the request gets to an interceptor. An unambiguous :authority is defined

Callers

nothing calls this directly

Calls 6

StartMethod · 0.95
StopMethod · 0.95
StreamInterceptorFunction · 0.92
FatalfMethod · 0.65
StreamingOutputCallMethod · 0.65
RecvMethod · 0.65

Tested by

no test coverage detected