package hostclaim import ( "errors" "testing" ) // m-2 (platform-1e; moves Plan 3 Task 7): the commit follows probed only, so // Group D's adjacent-step rule (probing, probed, committed) holds. A commit // from probing is refused and leaves the claim as it found it. func TestCommitAcceptsOnlyProbed(t *testing.T) { c := probedLanding(t) c.Op.Phase = "probing" before := string(mustJSON(t, c)) src, stg := commitScopes(c) if err := Commit(moveA, "ie", "ie-box", "uk", src, stg, counter())(c); !errors.Is(err, ErrWrongState) || string(mustJSON(t, c)) != before { t.Fatalf("a commit from probing: %v", err) } c = probedLanding(t) c.Op.Phase = "probed" src, stg = commitScopes(c) if err := KeepWriterSession(moveA, Commit(moveA, "ie", "ie-box", "uk", src, stg, counter()))(c); err != nil || c.Op.Phase != PhaseCommitted { t.Fatalf("a commit from probed under the session guard: %v %+v", err, c.Op) } }