vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Report what a run was doing when an integration wait times out
7178cad6da30afd446141ea1fa25849ff4a1e176 · Keenan Nemetz · 9d ago · parent 51c4cc66
Report what a run was doing when an integration wait times out `waitForRun` printed the run slice with %+v, so a failed wait said only "saw 1 run(s): [0xc026464e08]". It now names each run's id, status, attempt and lease deadline, which is the difference between "still queued", "reported a failure" and "the runner never reported" — the whole question when a wait times out. The three artifact tests waited for StatusSuccess alone, so a job that failed was reported as a ten-second timeout with the reason left in a log nobody looked at. They now use terminalRun, which is moved beside waitForRun, and it fails with the run's exit code and log. This is diagnosis, not a fix for a lost report. A combined-result verify on this branch failed TestRunArtifactsArePrivateForPrivateRepos this way while the same tree's branch verify passed, and an earlier combined result on main failed eight tests with the same timeouts, so the transient predates this work. What the change itself cannot have done is orphan a finished attempt: a sweep requeues an expired lease but keeps the owner, and RecordAttempt still accepts the late record — TestRecordAttemptAcceptsALateFinishBeforeAnotherLease holds it to that. Nothing changes what a test asserts when a run reports: only what it says when one does not.
server/integration_test.go +29−1
| @@ -3096,10 +3096,38 @@ func (f *fixture) waitForRun(t *testing.T, within time.Duration, match func(*run | |||
| 3096 | 3096 | } | |
| 3097 | 3097 | time.Sleep(20 * time.Millisecond) | |
| 3098 | 3098 | } | |
| 3099 | t.Fatalf("no matching run after %s; saw %d run(s): %+v", within, len(last), last) | ||
| 3099 | // A pointer for each run tells a reader nothing. The status, the attempt and | ||
| 3100 | // whether a lease is still owed distinguish "still queued", "reported a | ||
| 3101 | // failure" and "the runner never reported", which is the whole question when a | ||
| 3102 | // wait times out. | ||
| 3103 | seen := make([]string, 0, len(last)) | ||
| 3104 | for _, r := range last { | ||
| 3105 | lease := "" | ||
| 3106 | if !r.LeaseUntil.IsZero() { | ||
| 3107 | lease = " leased until " + r.LeaseUntil.Format(time.RFC3339) | ||
| 3108 | } | ||
| 3109 | seen = append(seen, fmt.Sprintf("%s %s attempt %d%s", r.ID, r.Status, r.Attempts, lease)) | ||
| 3110 | } | ||
| 3111 | t.Fatalf("no matching run after %s; saw %d: %s", within, len(last), strings.Join(seen, "; ")) | ||
| 3100 | 3112 | return nil | |
| 3101 | 3113 | } | |
| 3102 | 3114 | ||
| 3115 | // terminalRun waits for the newest run to stop moving and complains with its log if | ||
| 3116 | // it failed. A run that failed under a broken step is a diagnosis, not a timeout: | ||
| 3117 | // the test output names the exit code and the log, so nobody has to rerun it under | ||
| 3118 | // a debugger to learn what happened. | ||
| 3119 | func (f *fixture) terminalRun(t *testing.T) *runs.Run { | ||
| 3120 | t.Helper() | ||
| 3121 | run := f.waitForRun(t, 15*time.Second, func(r *runs.Run) bool { | ||
| 3122 | return r.Status == runs.StatusSuccess || r.Status == runs.StatusFailed | ||
| 3123 | }) | ||
| 3124 | if run.Status == runs.StatusFailed { | ||
| 3125 | _, log := f.get("/" + f.repo + "/runs/" + run.ID + "/log") | ||
| 3126 | t.Fatalf("run %s failed (exit %d):\n%s", run.ID, run.ExitCode, log) | ||
| 3127 | } | ||
| 3128 | return run | ||
| 3129 | } | ||
| 3130 | |||
| 3103 | 3131 | func workflowFile(body string) map[string]string { | |
| 3104 | 3132 | return map[string]string{".vole/workflows/ci.yaml": body} | |
| 3105 | 3133 | } | |