(ctx context.Context, config SoakIterationConfig)
| 64 | } |
| 65 | |
| 66 | func doOneSoakIteration(ctx context.Context, config SoakIterationConfig) (latency time.Duration, err error) { |
| 67 | start := time.Now() |
| 68 | // Do a large-unary RPC. |
| 69 | // Create the request payload. |
| 70 | pl := ClientNewPayload(testpb.PayloadType_COMPRESSABLE, config.RequestSize) |
| 71 | req := &testpb.SimpleRequest{ |
| 72 | ResponseType: testpb.PayloadType_COMPRESSABLE, |
| 73 | ResponseSize: int32(config.ResponseSize), |
| 74 | Payload: pl, |
| 75 | } |
| 76 | // Perform the GRPC call. |
| 77 | var reply *testpb.SimpleResponse |
| 78 | reply, err = config.Client.UnaryCall(ctx, req, config.CallOptions...) |
| 79 | if err != nil { |
| 80 | err = fmt.Errorf("/TestService/UnaryCall RPC failed: %s", err) |
| 81 | return 0, err |
| 82 | } |
| 83 | // Validate response. |
| 84 | t := reply.GetPayload().GetType() |
| 85 | s := len(reply.GetPayload().GetBody()) |
| 86 | if t != testpb.PayloadType_COMPRESSABLE || s != config.ResponseSize { |
| 87 | err = fmt.Errorf("got the reply with type %d len %d; want %d, %d", t, s, testpb.PayloadType_COMPRESSABLE, config.ResponseSize) |
| 88 | return 0, err |
| 89 | } |
| 90 | // Calculate latency and return result. |
| 91 | latency = time.Since(start) |
| 92 | return latency, nil |
| 93 | } |
| 94 | |
| 95 | func executeSoakTestInWorker(ctx context.Context, config SoakTestConfig, startTime time.Time, workerID int, soakWorkerResults *SoakWorkerResults) { |
| 96 | timeoutDuration := config.OverallTimeout |
no test coverage detected