Report known zero usage when smoke tests do not dispatch
This commit is contained in:
@@ -184,7 +184,8 @@ func TestSmokeTesterReportsUnsupportedAndInapplicableAuthentication(t *testing.T
|
||||
t.Fatal(err)
|
||||
}
|
||||
if report.Supported != tc.supported || report.Reason != tc.reason || !report.Completed ||
|
||||
!sameBool(report.Applicable, tc.applicable) || len(report.Attempts) != 0 || report.Facts != (domain.SmokeTestFacts{}) {
|
||||
!sameBool(report.Applicable, tc.applicable) || len(report.Attempts) != 0 || report.Facts != (domain.SmokeTestFacts{}) ||
|
||||
report.Usage != noDispatchUsage() {
|
||||
t.Fatalf("report = %+v", report)
|
||||
}
|
||||
})
|
||||
@@ -201,7 +202,7 @@ func TestSmokeTesterReportsReachabilityUnavailableWithoutHTTPClient(t *testing.T
|
||||
}
|
||||
if report.Supported || report.Applicable != nil || !report.Completed ||
|
||||
report.Reason != domain.SmokeTestReasonHTTPDiagnosticsUnavailable ||
|
||||
len(report.Attempts) != 0 || report.Facts != (domain.SmokeTestFacts{}) {
|
||||
len(report.Attempts) != 0 || report.Facts != (domain.SmokeTestFacts{}) || report.Usage != noDispatchUsage() {
|
||||
t.Fatalf("unsupported reachability report = %+v", report)
|
||||
}
|
||||
}
|
||||
@@ -226,14 +227,16 @@ func TestSmokeTesterSelectionAndCancellationDoNotDispatch(t *testing.T) {
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
report, err := tester.Run(ctx, domain.SmokeTestRequest{
|
||||
Kind: domain.SmokeTestReachability, BackendID: "alpha",
|
||||
})
|
||||
if !errors.Is(err, context.Canceled) || report == nil || report.Completed || report.Failure != domain.ExecutionFailureCanceled {
|
||||
t.Fatalf("canceled report=%+v error=%v", report, err)
|
||||
}
|
||||
if report.Facts != (domain.SmokeTestFacts{}) || len(report.Attempts) != 0 || calls != 0 {
|
||||
t.Fatalf("cancellation dispatched or invented facts: %+v calls=%d", report, calls)
|
||||
for _, kind := range []domain.SmokeTestKind{domain.SmokeTestReachability, domain.SmokeTestTextInference} {
|
||||
report, err := tester.Run(ctx, domain.SmokeTestRequest{
|
||||
Kind: kind, BackendID: "alpha",
|
||||
})
|
||||
if !errors.Is(err, context.Canceled) || report == nil || report.Completed || report.Failure != domain.ExecutionFailureCanceled {
|
||||
t.Fatalf("canceled report=%+v error=%v", report, err)
|
||||
}
|
||||
if report.Facts != (domain.SmokeTestFacts{}) || len(report.Attempts) != 0 || calls != 0 || report.Usage != noDispatchUsage() {
|
||||
t.Fatalf("cancellation dispatched, invented facts, or left usage unknown: %+v calls=%d", report, calls)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user