Preserve smoke observer failures independently of readiness
This commit is contained in:
@@ -122,3 +122,29 @@ func TestPreflightDebugAllocationFailureAndDisable(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPreflightCaptureFailureBeforeLastProfileIsNotReady(t *testing.T) {
|
||||
probe := &runProbe{}
|
||||
_, config, input, _ := runFixture(t, probe, func(configuration string) string {
|
||||
return strings.Replace(configuration, "id: inspect-validator\n default_profile: partial", "id: inspect-validator\n default_profile: chosen", 1)
|
||||
})
|
||||
root := t.TempDir()
|
||||
calls := 0
|
||||
client := captureClient(func(context.Context, promptkit.GenerateRequest) (*promptkit.GenerateResponse, error) {
|
||||
calls++
|
||||
if err := os.Mkdir(filepath.Join(root, "inspection", "smoke", "004.json"), 0o700); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return &promptkit.GenerateResponse{Content: `{"status":"ok"}`}, nil
|
||||
})
|
||||
app, err := NewApplication("test", Options{Registries: runRegistries(t, probe), LLMClient: client, RunIDGenerator: func(time.Time) (string, error) { return "inspection", nil }})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var out, stderr bytes.Buffer
|
||||
outcome := app.Execute(context.Background(), []string{"preflight", "demo", "--config", config, "--input-file", input, "--cache", "bypass", "--debug", "--debug-dir", root, "--format", "json"}, commandkit.Streams{Out: &out, Err: &stderr})
|
||||
var report preflightReport
|
||||
if err := json.Unmarshal(out.Bytes(), &report); err != nil || report.Ready || outcome.Status == 0 || calls != 1 {
|
||||
t.Fatalf("outcome=%+v report=%+v error=%v calls=%d", outcome, report, err, calls)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user