Assemble HTTP smoke-test reports

This commit is contained in:
2026-10-13 17:48:21 +00:00
parent 8d05b594e2
commit f0182fb2c9
5 changed files with 619 additions and 14 deletions

View File

@@ -31,6 +31,14 @@ func (p authenticationProbe) run(
backend domain.Backend,
target domain.SmokeTestTarget,
) (authenticationProbeOutcome, error) {
outcome, err := p.support(backend)
if err != nil || !outcome.supported || (outcome.applicable != nil && !*outcome.applicable) {
return outcome, err
}
return p.runOpenRouterKey(ctx, target)
}
func (p authenticationProbe) support(backend domain.Backend) (authenticationProbeOutcome, error) {
if backend.SmokeTests == nil || backend.SmokeTests.Authentication == nil {
return authenticationProbeOutcome{reason: domain.SmokeTestReasonProbeNotConfigured}, nil
}
@@ -46,7 +54,10 @@ func (p authenticationProbe) run(
reason: domain.SmokeTestReasonAuthenticationNotApplicable,
}, nil
case "openrouter_key":
return p.runOpenRouterKey(ctx, target)
if p.client == nil {
return authenticationProbeOutcome{reason: domain.SmokeTestReasonHTTPDiagnosticsUnavailable}, nil
}
return authenticationProbeOutcome{supported: true, applicable: boolPointer(true)}, nil
default:
return authenticationProbeOutcome{}, fmt.Errorf("%w: unsupported authentication probe kind %q", ErrInvalidRequest, *authentication.Kind)
}
@@ -56,14 +67,6 @@ func (p authenticationProbe) runOpenRouterKey(
ctx context.Context,
target domain.SmokeTestTarget,
) (authenticationProbeOutcome, error) {
applicable := boolPointer(true)
if p.client == nil {
return authenticationProbeOutcome{
applicable: applicable,
reason: domain.SmokeTestReasonHTTPDiagnosticsUnavailable,
}, nil
}
endpoint, err := endpointWithoutUserInfo(target.Endpoint)
if err != nil {
return authenticationProbeOutcome{}, fmt.Errorf("prepare authentication endpoint: %w", err)
@@ -79,7 +82,7 @@ func (p authenticationProbe) runOpenRouterKey(
}
outcome := authenticationProbeOutcome{
supported: true,
applicable: applicable,
applicable: boolPointer(true),
evidence: evidence,
}
if evidence.ResponseReceived || response != nil {