core: testDiffFn must properly populate "Old" in computed attr diff
When applying a diff to a value we verify that the "old" value in diff is consistent with the given prior value, as a safety check. The mock must comply with this or else any tests that produce diffs with computed new values will not pass the safety check. This change is verified by the now-passing TestContext2Apply_taintDep .
This commit is contained in:
parent
42febd5d14
commit
8db60c0c35
|
@ -296,8 +296,12 @@ func testDiffFn(
|
||||||
if k == "id" {
|
if k == "id" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
old := ""
|
||||||
|
if s != nil {
|
||||||
|
old = s.Attributes[k]
|
||||||
|
}
|
||||||
diff.Attributes[k] = &ResourceAttrDiff{
|
diff.Attributes[k] = &ResourceAttrDiff{
|
||||||
Old: "",
|
Old: old,
|
||||||
NewComputed: true,
|
NewComputed: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue