Download this file
| 1 | package host |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "testing" |
| 6 | "time" |
| 7 | |
| 8 | "github.com/carlosframework/platform/internal/provision" |
| 9 | ) |
| 10 | |
| 11 | func TestPlan9B8MovesPassUsesCapturedClaimFlag(t *testing.T) { |
| 12 | for _, enabled := range []bool{false, true} { |
| 13 | h := newMoveHarness(t) |
| 14 | host := "a.go.example.com" |
| 15 | h.record(t, host, provision.MoveRequest("uk", time.Now()), provision.MoveAbort()) |
| 16 | h.cfg.claimRecords = enabled |
| 17 | if err := movesPass(context.Background(), h.s, h.worker()); err != nil { |
| 18 | t.Fatal(err) |
| 19 | } |
| 20 | rec := h.read(t, host) |
| 21 | want := uint64(0) |
| 22 | if enabled { |
| 23 | want = 1 |
| 24 | } |
| 25 | if rec.Move != nil || rec.RecordSeq != want { |
| 26 | t.Fatalf("claim=%v record=%+v", enabled, rec) |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | |