(_ context.Context, in *testpb.ClientConfigureRequest)
| 288 | } |
| 289 | |
| 290 | func (s *configureService) Configure(_ context.Context, in *testpb.ClientConfigureRequest) (*testpb.ClientConfigureResponse, error) { |
| 291 | rpcsToMD := make(map[testpb.ClientConfigureRequest_RpcType][]string) |
| 292 | for _, typ := range in.GetTypes() { |
| 293 | rpcsToMD[typ] = nil |
| 294 | } |
| 295 | for _, md := range in.GetMetadata() { |
| 296 | typ := md.GetType() |
| 297 | strs, ok := rpcsToMD[typ] |
| 298 | if !ok { |
| 299 | continue |
| 300 | } |
| 301 | rpcsToMD[typ] = append(strs, md.GetKey(), md.GetValue()) |
| 302 | } |
| 303 | cfgs := make([]*rpcConfig, 0, len(rpcsToMD)) |
| 304 | for typ, md := range rpcsToMD { |
| 305 | var rpcType string |
| 306 | switch typ { |
| 307 | case testpb.ClientConfigureRequest_UNARY_CALL: |
| 308 | rpcType = unaryCall |
| 309 | case testpb.ClientConfigureRequest_EMPTY_CALL: |
| 310 | rpcType = emptyCall |
| 311 | default: |
| 312 | return nil, fmt.Errorf("unsupported RPC type: %v", typ) |
| 313 | } |
| 314 | cfgs = append(cfgs, &rpcConfig{ |
| 315 | typ: rpcType, |
| 316 | md: metadata.Pairs(md...), |
| 317 | timeout: in.GetTimeoutSec(), |
| 318 | }) |
| 319 | } |
| 320 | rpcCfgs.Store(cfgs) |
| 321 | return &testpb.ClientConfigureResponse{}, nil |
| 322 | } |
| 323 | |
| 324 | const ( |
| 325 | unaryCall string = "UnaryCall" |
nothing calls this directly
no test coverage detected