Replace session validation with standalone preflight
This commit is contained in:
@@ -36,23 +36,23 @@ func TestSessionValidationCommandReturnsFindingsWithoutRuntimeState(t *testing.T
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
outcome := app.Execute(context.Background(), []string{"session", "validate", "2026-05-03", "--config", pipeline, "--campaign-file", campaign, "--session-file", session, "--format", "json"}, commandkit.Streams{Out: &out, Err: &diagnostic})
|
||||
outcome := app.Execute(context.Background(), []string{"preflight", "2026-05-03", "--config", pipeline, "--campaign-file", campaign, "--session-file", session, "--format", "json"}, commandkit.Streams{Out: &out, Err: &diagnostic})
|
||||
if outcome.Status != 1 {
|
||||
t.Fatalf("status=%d diagnostics=%s", outcome.Status, diagnostic.String())
|
||||
}
|
||||
var report sessionValidationReport
|
||||
var report sessionReadinessReport
|
||||
if err := json.Unmarshal(out.Bytes(), &report); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if report.Valid || report.SessionID != "2026-05-03" || len(report.Findings) == 0 {
|
||||
if report.Ready || report.SessionID != "2026-05-03" || len(report.Findings) == 0 {
|
||||
t.Fatalf("report=%#v", report)
|
||||
}
|
||||
if !errors.Is(outcome.Cause, os.ErrNotExist) {
|
||||
t.Fatalf("missing input cause not retained: %v", outcome.Cause)
|
||||
}
|
||||
paths := artifacts.NewLocalStore(cfg.Pipeline.Workspace.Root).SessionPathsFor(cfg.Session.Campaign, cfg.Session.SessionID)
|
||||
if _, err := os.Stat(paths.Root); !os.IsNotExist(err) {
|
||||
t.Fatalf("preflight created runtime state: %v", err)
|
||||
if _, err := os.Stat(paths.ManifestPath); err != nil {
|
||||
t.Fatalf("preflight did not persist failure: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,15 +60,15 @@ func TestSessionValidationCommandReportsNativeConfigurationFailure(t *testing.T)
|
||||
pipeline := filepath.Join(t.TempDir(), "invalid.yml")
|
||||
mustWriteTestFile(t, pipeline, "unknown_field: value\n")
|
||||
var out, diagnostic bytes.Buffer
|
||||
outcome := Execute(context.Background(), []string{"session", "validate", "session", "--config", pipeline, "--format", "json"}, commandkit.Streams{Out: &out, Err: &diagnostic})
|
||||
outcome := Execute(context.Background(), []string{"preflight", "session", "--config", pipeline, "--format", "json"}, commandkit.Streams{Out: &out, Err: &diagnostic})
|
||||
if outcome.Status != 2 {
|
||||
t.Fatalf("status=%d diagnostics=%s", outcome.Status, diagnostic.String())
|
||||
}
|
||||
var report sessionValidationReport
|
||||
var report sessionReadinessReport
|
||||
if err := json.Unmarshal(out.Bytes(), &report); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if report.Valid || len(report.Findings) != 1 || report.Findings[0].Category != "config" {
|
||||
if report.Ready || len(report.Findings) != 1 || report.Findings[0].Category != "configuration" {
|
||||
t.Fatalf("report=%#v", report)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user