test: the procedure gate's captured outputs as fixtures

The move to s2, HEAD reclaimed by s2, the forced move, its dry-run
previews (refused with an admissible time, then admitted) and lost-range,
captured from a passing gate run, are read by the default-build check
test; each check also refuses a neighbouring output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 5.5 committed 2026-11-22 07:46:41 -08:00
1 parent 339932cb61
commit 4098abca82
7 files changed
+47 -3

No files matched your search

@@ -229,9 +229,10 @@ func matchUint(re *regexp.Regexp, s string) (uint64, error) {
// TestPlannedHandoffChecksReadCapturedProductOutput runs every check on the
// output the real binaries printed in one passing hand-over (E=1, G=3, L=1,
// E2=2) and in the refused clean move without an ACK (move-refused,
// show-revoked), and each check on an output of another step, which it must
// refuse.
// E2=2), in the refused clean move without an ACK (move-refused,
// show-revoked), and in the procedure gate's move to s2 and forced move
// (move-clean-s2, head-reopened-s2, force-move*, lost-range), and each check
// on an output of another step, which it must refuse.
func TestPlannedHandoffChecksReadCapturedProductOutput(t *testing.T) {
read := func(name string) string {
b, err := os.ReadFile(filepath.Join("testdata", "planned-handoff", name))
@@ -302,6 +303,34 @@ func TestPlannedHandoffChecksReadCapturedProductOutput(t *testing.T) {
if r := read("show-revoked.stdout"); showsAck(r, e, g) || !hasLine(r, "recorded ACK: none") {
t.Error("the revoked show without an ACK is read as acknowledged")
}
// The procedure gate's two-host outputs (a planned move to s2, a forced
// move s1 -> s2 at E=1 -> E2=2 keeping gen 3, LSN 1).
if got, err := movedEpochTo(read("move-clean-s2.stdout"), e, g, l, "s2"); err != nil || got != e2 {
t.Errorf("moved epoch to s2 %d, %v; want %d", got, err, e2)
}
_, err = movedEpochTo(read("move-clean-s2.stdout"), e, g, l, "s1")
refused("clean move to s2 read as a move to s1", err)
ok("HEAD reopened by s2", checkHeadReopenedBy(read("head-reopened-s2.stdout"), e2, g, l, "s2"))
refused("HEAD reopened by s2 read as s1's", checkHeadReopenedBy(read("head-reopened-s2.stdout"), e2, g, l, "s1"))
if got, err := forcedEpoch(read("force-move.stdout"), e, "s1", "s2"); err != nil || got != e2 {
t.Errorf("forced epoch %d, %v; want %d", got, err, e2)
}
_, err = forcedEpoch(read("force-move.stdout"), e, "s2", "s1")
refused("forced move read the other way round", err)
_, err = forcedEpoch(read("move-clean-s2.stdout"), e, "s1", "s2")
refused("forced epoch", err)
if got, err := forcedKeptLSN(read("force-move.stdout")); err != nil || got != l {
t.Errorf("forced kept LSN %d, %v; want %d", got, err, l)
}
if !previewAdmitted(read("force-move-dry-run-admitted.stdout")) || previewAdmitted(read("force-move-dry-run-refused.stdout")) {
t.Error("the dry-run preview is not told admitted from not admitted")
}
if !strings.Contains(read("force-move-dry-run-refused.stdout"), "admissible at ") {
t.Error("the refused preview has no admissible time")
}
if !strings.Contains(read("lost-range.stdout"), "range 1 of 1: request force-v1-1, r1@") {
t.Error("lost-range does not show the forced move")
}
if !frontendReady([]byte(read("status-primary.json"))) || frontendReady([]byte(`{"FrontendPrimaryReady":false,"Healthy":true}`)) {
t.Error("the frontend-ready check does not read FrontendPrimaryReady")
}
@@ -0,0 +1,4 @@
preview (advisory): at master time 2026-11-22T15:36:16.705621624Z, may change; admission is re-checked at the move. Nothing was written; this is not a confirmation.
forced move admitted
HEAD now: gen 3, epoch 1, holder s1/r1, remote LSN 1, published at 2026-11-22T15:35:12Z (publishing host clock as recorded in the filer, 1 s resolution)
if moved now: writes with LSN <= 1 are kept; writes acknowledged after that and before 2026-11-22T15:36:16.617154582Z, master clock, may be lost
@@ -0,0 +1,3 @@
preview (advisory): at master time 2026-11-22T15:35:12.107989752Z, may change; admission is re-checked at the move. Nothing was written; this is not a confirmation.
forced move not admitted: workspace forced move lease expiry plus clock-skew margin has not elapsed
admissible at 2026-11-22T15:36:16.617154582Z, master clock
@@ -0,0 +1,3 @@
forced move issued: volume v1 request force-v1-1: r1@1 on s1 -> r1@2 on s2 (kept HEAD gen 3, remote LSN 1)
volume v1 restored to the last published image at 2026-11-22T15:35:12Z (publishing host clock as recorded in the filer, 1 s resolution) (gen 3, LSN 1): writes with LSN <= 1 are preserved; writes acknowledged by r1@1 after that and before 2026-11-22T15:36:16.617154582Z, master clock, may be lost; the upper bound is a time, not an LSN.
next: start volume v1 on s2 (this command moved authority only)
@@ -0,0 +1 @@
{"volumeID":"v1","volume":{"origin":"create","numBlocks":65536,"blockSize":4096,"chunkBlocks":1024,"createdNs":1795361693554515613,"parent":null},"head":{"gen":4,"epoch":2,"holder":"s2/r1","remoteLSN":1,"state":"active","detachedBy":null,"chunkCount":1}}
@@ -0,0 +1,2 @@
range 1 of 1: request force-v1-1, r1@1 -> epoch 2, lost after LSN 1, until 2026-11-22T15:36:16.617154582Z (master clock)
volume v1 restored to the last published image at 2026-11-22T15:35:12Z (publishing host clock as recorded in the filer, 1 s resolution) (gen 3, LSN 1): writes with LSN <= 1 are preserved; writes acknowledged by r1@1 after that and before 2026-11-22T15:36:16.617154582Z, master clock, may be lost; the upper bound is a time, not an LSN.
@@ -0,0 +1,2 @@
clean move issued: volume v1 request move-v1-1: r1@1 -> r1@2 on s2 (sealed HEAD gen 3, remote LSN 1)
next: start volume v1 on s2 (this command moved authority only)