MCPcopy
hub / github.com/connectrpc/connect-go / TestServerStreamForClient

Function TestServerStreamForClient

client_stream_test.go:86–103  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

84}
85
86func TestServerStreamForClient(t *testing.T) {
87 t.Parallel()
88 stream := &ServerStreamForClient[pingv1.PingResponse]{
89 conn: &nopStreamingClientConn{},
90 }
91 // Ensure that each call to Receive allocates a new message. This helps
92 // vtprotobuf, which doesn't automatically zero messages before unmarshaling
93 // (see https://connectrpc.com/connect/issues/345), and it's also
94 // less error-prone for users.
95 assert.True(t, stream.Receive())
96 first := fmt.Sprintf("%p", stream.Msg())
97 assert.True(t, stream.Receive())
98 second := fmt.Sprintf("%p", stream.Msg())
99 assert.NotEqual(t, first, second)
100 conn, err := stream.Conn()
101 assert.Nil(t, err)
102 assert.NotNil(t, conn)
103}
104
105func TestBidiStreamForClient_InitErrNoPanics(t *testing.T) {
106 t.Parallel()

Callers

nothing calls this directly

Calls 7

TrueFunction · 0.92
NotEqualFunction · 0.92
NilFunction · 0.92
NotNilFunction · 0.92
ReceiveMethod · 0.65
MsgMethod · 0.45
ConnMethod · 0.45

Tested by

no test coverage detected