Retain safe CI diagnostics in rehearsal results
This commit is contained in:
@@ -64,6 +64,8 @@ func TestCleanupCommandSelectsExplicitRecordAndReportsSeparateOutcome(t *testing
|
||||
t.Fatal(err)
|
||||
}
|
||||
record := rehearsal.Attempt{Forge: "gitea", Manifest: manifest, RepositoryDir: repo, TagObject: object, Outcomes: map[string]string{"tag": "created", "push": "not_attempted", "workflow": "failed", "verification": "incomplete", "cleanup": "pending"}}
|
||||
record.JobEvidence = &rehearsal.JobResult{Manifest: manifest, Scope: "page", Build: "not_requested", Delivery: "not_attempted", Verification: "not_attempted", Diagnostics: []string{"delivery credential unavailable", "prepare build dependencies", "diagnostic delivery failed"}}
|
||||
|
||||
store, err := rehearsal.CreateAttempt(t.Context(), repo, "", record)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -74,6 +76,11 @@ func TestCleanupCommandSelectsExplicitRecordAndReportsSeparateOutcome(t *testing
|
||||
if err := json.Unmarshal(output.Bytes(), &doc); err != nil || status != 0 || doc.Cleanup != "complete" || doc.Verification != "incomplete" || doc.RecordPath != store.Path {
|
||||
t.Fatalf("status=%d output=%s diagnostics=%s error=%v", status, &output, &diagnostics, err)
|
||||
}
|
||||
for _, phase := range record.JobEvidence.Diagnostics {
|
||||
if !strings.Contains(output.String(), phase) {
|
||||
t.Fatalf("JSON dropped job phase %q: %s", phase, &output)
|
||||
}
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(repo, ".git", "refs", "tags", filepath.FromSlash(identity.Tag))); !os.IsNotExist(err) {
|
||||
t.Fatalf("local tag remains: %v", err)
|
||||
}
|
||||
@@ -87,6 +94,11 @@ func TestCleanupCommandSelectsExplicitRecordAndReportsSeparateOutcome(t *testing
|
||||
binary := buildWorkflowCLI(t, cliRepositoryRoot(t))
|
||||
command := exec.Command(binary, "test-cleanup", "--record", store.Path)
|
||||
text, err := command.CombinedOutput()
|
||||
for _, phase := range record.JobEvidence.Diagnostics {
|
||||
if !strings.Contains(string(text), phase) {
|
||||
t.Fatalf("human output dropped job phase %q: %s", phase, text)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatalf("built cleanup: %v: %s", err, text)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user