carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1//go:build unix
2
3package hostbox
4
5import (
6 "testing"
7
8 "github.com/carlosframework/platform/internal/hostclaim"
9)
10
11// M9: the selected work keeps its session only across adjacent forward steps
12// it has itself checked. A probing selection that never checked probed
13// refuses committed, and once it has checked a step it refuses going back.
14func TestPlan9Fix1SelectedWorkRefusesASkippedObservation(t *testing.T) {
15 work, _, update := plan9D1Probe(t, hostclaim.SessionContinues)
16 if err := plan9D1Write(work); err != nil {
17 t.Fatal(err)
18 }
19 update(hostclaim.SetMovePhase("m1", hostclaim.KindLanding, hostclaim.PhaseLandingProbing, hostclaim.PhaseLandingProbed))
20 update(hostclaim.KeepWriterSession("m1", hostclaim.SetMovePhase("m1", hostclaim.KindLanding, hostclaim.PhaseLandingProbed, hostclaim.PhaseLandingCommitted)))
21 if err := plan9D1Write(work); err == nil {
22 t.Fatal("a probing selection kept its session at committed without checking probed")
23 }
24}
25
26func TestPlan9Fix1SelectedWorkRefusesABackwardStepAfterAdvancing(t *testing.T) {
27 work, _, update := plan9D1Probe(t, hostclaim.SessionContinues)
28 update(hostclaim.SetMovePhase("m1", hostclaim.KindLanding, hostclaim.PhaseLandingProbing, hostclaim.PhaseLandingProbed))
29 if err := plan9D1Write(work); err != nil {
30 t.Fatalf("adjacent step: %v", err)
31 }
32 update(func(c *hostclaim.Claim) error { c.Op.Phase = hostclaim.PhaseLandingProbing; return nil })
33 if err := plan9D1Write(work); err == nil {
34 t.Fatal("the selection went back to probing after checking probed")
35 }
36}
37