//go:build unix package hostbox import ( "testing" "github.com/carlosframework/platform/internal/hostclaim" ) // M9: the selected work keeps its session only across adjacent forward steps // it has itself checked. A probing selection that never checked probed // refuses committed, and once it has checked a step it refuses going back. func TestPlan9Fix1SelectedWorkRefusesASkippedObservation(t *testing.T) { work, _, update := plan9D1Probe(t, hostclaim.SessionContinues) if err := plan9D1Write(work); err != nil { t.Fatal(err) } update(hostclaim.SetMovePhase("m1", hostclaim.KindLanding, hostclaim.PhaseLandingProbing, hostclaim.PhaseLandingProbed)) update(hostclaim.KeepWriterSession("m1", hostclaim.SetMovePhase("m1", hostclaim.KindLanding, hostclaim.PhaseLandingProbed, hostclaim.PhaseLandingCommitted))) if err := plan9D1Write(work); err == nil { t.Fatal("a probing selection kept its session at committed without checking probed") } } func TestPlan9Fix1SelectedWorkRefusesABackwardStepAfterAdvancing(t *testing.T) { work, _, update := plan9D1Probe(t, hostclaim.SessionContinues) update(hostclaim.SetMovePhase("m1", hostclaim.KindLanding, hostclaim.PhaseLandingProbing, hostclaim.PhaseLandingProbed)) if err := plan9D1Write(work); err != nil { t.Fatalf("adjacent step: %v", err) } update(func(c *hostclaim.Claim) error { c.Op.Phase = hostclaim.PhaseLandingProbing; return nil }) if err := plan9D1Write(work); err == nil { t.Fatal("the selection went back to probing after checking probed") } }