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

Function testCompressServerHasNoSupport

test/compressor_test.go:125–159  ·  view source on GitHub ↗
(t *testing.T, e env)

Source from the content-addressed store, hash-verified

123}
124
125func testCompressServerHasNoSupport(t *testing.T, e env) {
126 te := newTest(t, e)
127 te.serverCompression = false
128 te.clientCompression = false
129 te.clientNopCompression = true
130 te.startServer(&testServer{security: e.security})
131 defer te.tearDown()
132 tc := testgrpc.NewTestServiceClient(te.clientConn())
133
134 const argSize = 271828
135 const respSize = 314159
136 payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, argSize)
137 if err != nil {
138 t.Fatal(err)
139 }
140 req := &testpb.SimpleRequest{
141 ResponseType: testpb.PayloadType_COMPRESSABLE,
142 ResponseSize: respSize,
143 Payload: payload,
144 }
145
146 ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
147 defer cancel()
148 if _, err := tc.UnaryCall(ctx, req); err == nil || status.Code(err) != codes.Unimplemented {
149 t.Fatalf("TestService/UnaryCall(_, _) = _, %v, want _, error code %s", err, codes.Unimplemented)
150 }
151 // Streaming RPC
152 stream, err := tc.FullDuplexCall(ctx)
153 if err != nil {
154 t.Fatalf("%v.FullDuplexCall(_) = _, %v, want <nil>", tc, err)
155 }
156 if _, err := stream.Recv(); err == nil || status.Code(err) != codes.Unimplemented {
157 t.Fatalf("%v.Recv() = %v, want error code %s", stream, err, codes.Unimplemented)
158 }
159}
160
161func (s) TestCompressOK(t *testing.T) {
162 for _, e := range listTestEnv() {

Callers 1

Calls 11

UnaryCallMethod · 0.95
FullDuplexCallMethod · 0.95
CodeFunction · 0.92
newPayloadFunction · 0.85
newTestFunction · 0.70
FatalMethod · 0.65
FatalfMethod · 0.65
RecvMethod · 0.65
startServerMethod · 0.45
tearDownMethod · 0.45
clientConnMethod · 0.45

Tested by

no test coverage detected