Report known zero usage when smoke tests do not dispatch
This commit is contained in:
@@ -57,6 +57,12 @@ func (t *SmokeTester) Run(ctx context.Context, request domain.SmokeTestRequest)
|
||||
}
|
||||
finish := func(err error) (*domain.SmokeTestReport, error) {
|
||||
report.Timing.Duration = nonnegativeDuration(now().UTC().Sub(startedAt))
|
||||
for _, attempt := range report.Attempts {
|
||||
if attempt.Dispatched {
|
||||
return report, err
|
||||
}
|
||||
}
|
||||
report.Usage = noDispatchUsage()
|
||||
return report, err
|
||||
}
|
||||
|
||||
@@ -163,7 +169,6 @@ func (t *SmokeTester) runInference(
|
||||
if errors.Is(err, ErrAPIKeyRequired) || errors.Is(err, ErrAPIKeyEnvMissing) {
|
||||
report.Reason = domain.SmokeTestReasonRequiredCredentialMissing
|
||||
report.Failure = domain.ExecutionFailureInvalidRequest
|
||||
report.Usage = noDispatchUsage()
|
||||
report.Completed = true
|
||||
return finish(nil)
|
||||
}
|
||||
@@ -187,13 +192,11 @@ func (t *SmokeTester) runInference(
|
||||
if err != nil {
|
||||
if contextErr := ctx.Err(); contextErr != nil {
|
||||
report.Failure = generation.ClassifyFailure(contextErr)
|
||||
report.Usage = noDispatchUsage()
|
||||
return finish(contextErr)
|
||||
}
|
||||
var capacityErr *CapacityError
|
||||
if errors.As(err, &capacityErr) {
|
||||
report.Failure = domain.ExecutionFailureCapacity
|
||||
report.Usage = noDispatchUsage()
|
||||
report.Completed = true
|
||||
return finish(nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user