Publish inspection through one frozen history model
This commit is contained in:
@@ -308,16 +308,28 @@ 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}}}
|
||||
inspection := &Inspection{
|
||||
baseline: root, input: root, final: root,
|
||||
applications: []historyApplication{{layer: LayerBase, value: root}},
|
||||
}
|
||||
builder := newHistoryBuilder()
|
||||
builder.model.baseline = root
|
||||
builder.model.final = root
|
||||
builder.model.sourcePayloads = []historySourcePayload{{
|
||||
kind: historySourceApplicationPayload, application: historyApplication{layer: LayerBase, value: root},
|
||||
}}
|
||||
model := builder.freeze()
|
||||
inspection := &Inspection{history: model, metadata: Metadata{historyModel: model}, final: 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)
|
||||
inspection.input = other
|
||||
builder = newHistoryBuilder()
|
||||
builder.model.baseline = root
|
||||
builder.model.final = root
|
||||
builder.model.sourcePayloads = []historySourcePayload{{
|
||||
kind: historySourceApplicationPayload, application: historyApplication{layer: LayerBase, value: other},
|
||||
}}
|
||||
model = builder.freeze()
|
||||
inspection.history = model
|
||||
inspection.metadata.historyModel = model
|
||||
counter = newRetainedNodeCounter(3)
|
||||
if addInspectionHistory(counter, inspection) {
|
||||
t.Fatal("distinct retained nodes did not consume the budget")
|
||||
@@ -425,7 +437,7 @@ func TestIntegerVersionInspectionRetainsInputAndReconcilesTypedValue(t *testing.
|
||||
if first.Config.Version != "4" || second.Config.Version != "4" {
|
||||
t.Fatalf("configurations = %#v / %#v", first.Config, second.Config)
|
||||
}
|
||||
inputVersion, inputOK := documentAtPath(first.applications[0].value, Keys("version"))
|
||||
inputVersion, inputOK := documentAtPath(first.history.sourcePayloads[0].application.value, Keys("version"))
|
||||
finalVersion, finalOK := documentAtPath(first.final, Keys("version"))
|
||||
if !inputOK || inputVersion.Kind != document.Number || inputVersion.Text != "4" ||
|
||||
!finalOK || finalVersion.Kind != document.String || finalVersion.Text != "4" {
|
||||
|
||||
Reference in New Issue
Block a user