( a *require.Assertions, label string, stats *taskqueuepb.TaskQueueStats, expectation taskQueueExpectations, )
| 1589 | } |
| 1590 | |
| 1591 | func validateTaskQueueStats( |
| 1592 | a *require.Assertions, |
| 1593 | label string, |
| 1594 | stats *taskqueuepb.TaskQueueStats, |
| 1595 | expectation taskQueueExpectations, |
| 1596 | ) { |
| 1597 | // Actual counter can be greater than the expected due to history retries. We make sure the counter is in |
| 1598 | // range [expected, expected+maxBacklogExtraTasks] |
| 1599 | a.GreaterOrEqual(stats.ApproximateBacklogCount, int64(expectation.BacklogCount), |
| 1600 | "%s: ApproximateBacklogCount should be at least %d, got %d", |
| 1601 | label, expectation.BacklogCount, stats.ApproximateBacklogCount) |
| 1602 | |
| 1603 | maxApproximateBacklogCount := int64(expectation.BacklogCount + expectation.MaxExtraTasks) |
| 1604 | a.LessOrEqual(stats.ApproximateBacklogCount, maxApproximateBacklogCount, |
| 1605 | "%s: ApproximateBacklogCount should be at most %d, got %d", |
| 1606 | label, maxApproximateBacklogCount, stats.ApproximateBacklogCount) |
| 1607 | |
| 1608 | a.Equal(stats.ApproximateBacklogCount == 0, stats.ApproximateBacklogAge.AsDuration() == time.Duration(0), |
| 1609 | "%s: ApproximateBacklogAge should be 0 when ApproximateBacklogCount is 0, got %s", |
| 1610 | label, stats.ApproximateBacklogAge.AsDuration()) |
| 1611 | } |
| 1612 | |
| 1613 | func createDeploymentOptions(deploymentName string, buildID string) *deploymentpb.WorkerDeploymentOptions { |
| 1614 | return &deploymentpb.WorkerDeploymentOptions{ |
no test coverage detected