Enforce the retained history node limit
This commit is contained in:
@@ -124,6 +124,7 @@ func inheritanceInspectionFromComposition(t *testing.T, composed *composedDocume
|
||||
}
|
||||
metadata := metadataFromDecoded(decoded)
|
||||
applyInheritanceMetadata(&metadata, composed.root, composed.origins, composed.overlays, expanded)
|
||||
metadata.inheritance = cloneInheritanceOperations(expanded.operations)
|
||||
finalizeMetadataPaths(&metadata, expanded.root, composed.applications, baseline, composed.root)
|
||||
return &Inspection{
|
||||
metadata: metadata, baseline: baseline, input: expanded.root, preCLI: expanded.root,
|
||||
@@ -388,15 +389,18 @@ func TestInheritanceHistoryPrecedesApplicationResolution(t *testing.T) {
|
||||
func TestHistoryNodeBudgetCountsSharedInheritanceEvidenceOnce(t *testing.T) {
|
||||
shared := &document.Node{Kind: document.String, Text: "shared"}
|
||||
extra := &document.Node{Kind: document.String, Text: "extra"}
|
||||
expansion := &inheritanceScope{
|
||||
root: shared,
|
||||
operations: []inheritanceOperation{{parent: shared, effective: shared}},
|
||||
replacements: []inheritanceReplacement{{before: shared, after: extra}},
|
||||
inspection := &Inspection{
|
||||
inheritance: []inheritanceOperation{{parent: shared, effective: shared}},
|
||||
metadata: Metadata{inheritance: []inheritanceOperation{{parent: shared, effective: extra}}},
|
||||
}
|
||||
if !historyNodesWithin(2, nil, nil, nil, nil, nil, expansion) ||
|
||||
historyNodesWithin(1, nil, nil, nil, nil, nil, expansion) {
|
||||
counter := newRetainedNodeCounter(2)
|
||||
if !addInspectionHistory(counter, inspection) || counter.count != 2 {
|
||||
t.Fatal("shared evidence node accounting is incorrect")
|
||||
}
|
||||
counter = newRetainedNodeCounter(1)
|
||||
if addInspectionHistory(counter, inspection) {
|
||||
t.Fatal("distinct inheritance evidence did not consume the budget")
|
||||
}
|
||||
}
|
||||
|
||||
func TestInheritanceExpansionEnforcesRetainedHistoryBudget(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user