Verify canonical partition restoration and frontend protocol fixture
This commit is contained in:
@@ -236,4 +236,25 @@ func TestCanonicalModelMigrationAndIncrementalLifecycle(t *testing.T) {
|
||||
if writer.Code != 409 {
|
||||
t.Fatal("expected-account barrier was ignored")
|
||||
}
|
||||
// A new partition's entry, owning canvas and versions publish atomically.
|
||||
newCanvas, newFrame := modelTestID(5000), modelTestID(5001)
|
||||
frame := modelTestNode(newFrame, root)
|
||||
frame["componentId"] = "frame"
|
||||
canvas := modelCanvas{ID: newCanvas, Parent: &modelParent{CanvasID: root, EntryElementID: newFrame}}
|
||||
edit(1010, map[string]int64{root: 8, newCanvas: 0}, modelChange{Kind: "canvas", ID: newCanvas, Before: modelJSON(nil), After: modelJSON(canvas)}, modelChange{Kind: "element", ID: newFrame, Before: modelJSON(nil), After: modelJSON(frame)})
|
||||
model = read()
|
||||
if model.Versions[newCanvas] != 1 || model.Canvases[newCanvas].Parent.EntryElementID != newFrame {
|
||||
t.Fatal("partition creation was not atomic")
|
||||
}
|
||||
edit(1011, map[string]int64{root: 9, newCanvas: 1}, modelChange{Kind: "canvas", ID: newCanvas, Before: modelJSON(canvas), After: modelJSON(nil)}, modelChange{Kind: "element", ID: newFrame, Before: modelJSON(frame), After: modelJSON(nil)})
|
||||
model = read()
|
||||
if _, exists := model.Canvases[newCanvas]; exists || model.Versions[newCanvas] != 2 {
|
||||
t.Fatal("partition archive lost its version fence")
|
||||
}
|
||||
frame["incarnation"] = float64(2)
|
||||
edit(1012, map[string]int64{root: 10, newCanvas: 2}, modelChange{Kind: "element", ID: newFrame, Before: modelJSON(nil), After: modelJSON(frame)}, modelChange{Kind: "canvas", ID: newCanvas, Before: modelJSON(nil), After: modelJSON(canvas)})
|
||||
model = read()
|
||||
if model.Versions[newCanvas] != 3 || modelInt(model.Elements[newFrame]["incarnation"]) != 2 {
|
||||
t.Fatal("partition restore reused a stale lifecycle or version")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user