Download this file
| 1 | package host |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/carlosframework/platform/internal/hostclaim" |
| 7 | ) |
| 8 | |
| 9 | // m-2: the wake checkpoint observes committed after a missed probed, for the |
| 10 | // same writer only. |
| 11 | func TestPlan9Fix2WakeCheckpointCatchesUpOnlyForTheSameWriter(t *testing.T) { |
| 12 | probing := plan9D1Session(hostclaim.PhaseLandingProbing, 11) |
| 13 | committed := plan9D1Session(hostclaim.PhaseLandingCommitted, 11) |
| 14 | a := &claimWakeAttempt{observed: probing} |
| 15 | if !a.advance(committed, claimWakeContinue) { |
| 16 | t.Fatal("an admitted writer lost its session across an unobserved probed") |
| 17 | } |
| 18 | if a.advance(plan9D1Session(hostclaim.PhaseLandingProbed, 11), claimWakeContinue) { |
| 19 | t.Fatal("the checkpoint went backward") |
| 20 | } |
| 21 | b := &claimWakeAttempt{observed: probing} |
| 22 | if b.advance(plan9D1Session(hostclaim.PhaseLandingCommitted, 12), claimWakeContinue) { |
| 23 | t.Fatal("a new session was caught up to") |
| 24 | } |
| 25 | other := plan9D1Session(hostclaim.PhaseLandingCommitted, 11) |
| 26 | other.Claim.Op.ID = "m2" |
| 27 | if b.advance(other, claimWakeContinue) { |
| 28 | t.Fatal("another op was caught up to") |
| 29 | } |
| 30 | } |
| 31 | |