(t *testing.T)
| 132 | } |
| 133 | |
| 134 | func (s) TestRecvBufferPoolUnary(t *testing.T) { |
| 135 | // TODO: See above |
| 136 | t.SkipNow() |
| 137 | tcs := []struct { |
| 138 | name string |
| 139 | callOpts []grpc.CallOption |
| 140 | }{ |
| 141 | { |
| 142 | name: "default", |
| 143 | }, |
| 144 | { |
| 145 | name: "useCompressor", |
| 146 | callOpts: []grpc.CallOption{ |
| 147 | grpc.UseCompressor(gzip.Name), |
| 148 | }, |
| 149 | }, |
| 150 | } |
| 151 | |
| 152 | for _, tc := range tcs { |
| 153 | t.Run(tc.name, func(t *testing.T) { |
| 154 | const largeSize = 1024 |
| 155 | |
| 156 | ss := &stubserver.StubServer{ |
| 157 | UnaryCallF: func(context.Context, *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { |
| 158 | return &testpb.SimpleResponse{ |
| 159 | Payload: &testpb.Payload{ |
| 160 | Body: make([]byte, largeSize), |
| 161 | }, |
| 162 | }, nil |
| 163 | }, |
| 164 | } |
| 165 | |
| 166 | pool := &checkBufferPool{} |
| 167 | sopts := []grpc.ServerOption{experimental.BufferPool(pool)} |
| 168 | dopts := []grpc.DialOption{experimental.WithBufferPool(pool)} |
| 169 | if err := ss.Start(sopts, dopts...); err != nil { |
| 170 | t.Fatalf("Error starting endpoint server: %v", err) |
| 171 | } |
| 172 | defer ss.Stop() |
| 173 | |
| 174 | ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) |
| 175 | defer cancel() |
| 176 | |
| 177 | const reqCount = 10 |
| 178 | for i := 0; i < reqCount; i++ { |
| 179 | if _, err := ss.Client.UnaryCall( |
| 180 | ctx, |
| 181 | &testpb.SimpleRequest{ |
| 182 | Payload: &testpb.Payload{ |
| 183 | Body: make([]byte, largeSize), |
| 184 | }, |
| 185 | }, |
| 186 | tc.callOpts..., |
| 187 | ); err != nil { |
| 188 | t.Fatalf("ss.Client.UnaryCall failed: %v", err) |
| 189 | } |
| 190 | } |
| 191 |
nothing calls this directly
no test coverage detected