test: headroom reports the forced move's last dry-run answer when it is never admitted

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 5.5 committed 2026-11-23 07:32:56 -08:00
1 parent c692f89462
commit 9c341c49ec
1 file changed
+9 -4
@@ -236,11 +236,16 @@ func TestHeadroomRefusesARestoreAndAForkTargetThenServesThem(t *testing.T) {
"--target-host", b7.id, "--target-data", b7.data, "--target-ctrl", b7.ctrl, "--request-id", "force-v6",
"--confirm-forced", fmt.Sprintf("v6@%d", e6)}
var preview string
poll(t, 150*time.Second, "the forced move of the refused, never-started target v6 was never admitted", func() bool {
for end := time.Now().Add(150 * time.Second); ; time.Sleep(2 * time.Second) {
out, errOut, _ := env.h.run(t, append(append([]string{}, move...), "--dry-run")...)
preview = out + errOut
return previewAdmitted(out)
})
preview = strings.TrimSpace(out + errOut)
if previewAdmitted(out) {
break
}
if time.Now().After(end) {
t.Fatalf("the forced move of the refused, never-started target v6 was never admitted in 150 s; the last dry run answered: %s", preview)
}
}
t.Logf("forced move of v6 admitted: %s", strings.TrimSpace(preview))
out, _ = env.h.command(t, move...)
issued := regexp.MustCompile(fmt.Sprintf(`(?m)^forced move issued: volume v6 request \S+: r1@%d on n-v6 -> r1@(\d+) on %s `, e6, regexp.QuoteMeta(b7.id)))