Enforce the retained history node limit
This commit is contained in:
@@ -308,12 +308,18 @@ func TestSecretsBootstrapLoadAndExplanationRemainSeparateAndSafe(t *testing.T) {
|
||||
func TestHistoryNodeBudgetCountsSharedTreesOnce(t *testing.T) {
|
||||
leaf := &document.Node{Kind: document.String, Text: "value"}
|
||||
root := &document.Node{Kind: document.Mapping, Mapping: []document.Entry{{Key: "value", Value: leaf}}}
|
||||
applications := []historyApplication{{layer: LayerBase, value: root}}
|
||||
if !historyNodesWithin(2, root, root, root, applications, nil) {
|
||||
inspection := &Inspection{
|
||||
baseline: root, input: root, final: root,
|
||||
applications: []historyApplication{{layer: LayerBase, value: root}},
|
||||
}
|
||||
counter := newRetainedNodeCounter(2)
|
||||
if !addInspectionHistory(counter, inspection) || counter.count != 2 {
|
||||
t.Fatal("structurally shared history was counted more than once")
|
||||
}
|
||||
other := document.Clone(root)
|
||||
if historyNodesWithin(3, root, other, root, applications, nil) {
|
||||
inspection.input = other
|
||||
counter = newRetainedNodeCounter(3)
|
||||
if addInspectionHistory(counter, inspection) {
|
||||
t.Fatal("distinct retained nodes did not consume the budget")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user