hostedops: test writes recovery status before done (2% flake)
TestConcurrentRequestersJoinOneRecovery marked the recovery unit done before writing its status file, so a requester could read "done" with no status and return 99 (4 in 200 runs, also before the Task 34 kit). The file now comes first, as ExecStopPost writes it before systemd reports the unit done. A rarer race in the test's early-state override remains (1 in 300).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+4
−1
internal/hostedops/fix3_test.go+4 −1
CI failed — run details
CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/hosted-runners-2: Type Size Avail | ext4 96G 84G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type Size Avail | ext4 96G 84G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 1.4s
ci-box: codex: fetched and verified in 3.6s
ci-box: codex-code-mode-host: fetched and verified in 1.5s
ci-box: libwrap: fetched and verified in 0.4s
ci-box: socat: fetched and verified in 0.4s
ci-box: tofu: fetched and verified in 1.8s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.8s
ci-box: pi: installed and verified in 7.2s
ci-box: opencode: installed and verified in 2.4s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 10.9s
ci-box: clone deepened in 6.1s
ci-box: file times set from content: 4063 files, 303 directories
ci-box: ready in 19.7s
=== copy ===
EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
--- FAIL: TestReleaseCopyReviewed (0.09s)
task_pages_test.go:236: COPY REVIEW REQUIRED: copy-status.py verify found copy pending review or stale bookkeeping
FAIL
rastrillo-budget/v1 ran 87ms
FAIL amadan.net/oficina/equipo/internal/equipotest 0.236s
FAIL
make: *** [Makefile:324: copy-release-check] Error 1
amadan: step copy failed: exit status 2
amadan: job failed at step copy — its output is above, not at the tail of this log
diff --git a/internal/hostedops/fix3_test.go b/internal/hostedops/fix3_test.go| index d9f330fa..b67a8e2d 100644 |
| --- a/internal/hostedops/fix3_test.go |
| +++ b/internal/hostedops/fix3_test.go |
| @@ -128,10 +128,13 @@ func TestConcurrentRequestersJoinOneRecovery(t *testing.T) { |
| if code := r.runUnit(recoveryUnit); code != 0 { |
| t.Fatalf("the recovery unit exited %d", code) |
| } |
| + // The status file first, as ExecStopPost writes it before systemd |
| + // reports the unit done: in the other order a requester can read |
| + // "done" with no status yet (a 2 percent flake). |
| + os.WriteFile(filepath.Join(r.dir, "units", "recovery.status"), []byte("0\n"), 0o600) |
| r.systemd.mu.Lock() |
| r.systemd.states[recoveryUnit] = "done" |
| r.systemd.mu.Unlock() |
| - os.WriteFile(filepath.Join(r.dir, "units", "recovery.status"), []byte("0\n"), 0o600) |
| got := []string{} |
| for range 2 { |
| select { |