Merge pull request #15556 from hashicorp/jbardin/backend-tests
backend state tests must honor lineage
This commit is contained in:
commit
87b2c0cf8f
|
@ -92,11 +92,20 @@ func testBackendStates(t *testing.T, b Backend) {
|
||||||
// start with a fresh state, and record the lineage being
|
// start with a fresh state, and record the lineage being
|
||||||
// written to "bar"
|
// written to "bar"
|
||||||
barState := terraform.NewState()
|
barState := terraform.NewState()
|
||||||
|
|
||||||
|
// creating the named state may have created a lineage, so use that if it exists.
|
||||||
|
if s := bar.State(); s != nil && s.Lineage != "" {
|
||||||
|
barState.Lineage = s.Lineage
|
||||||
|
}
|
||||||
barLineage := barState.Lineage
|
barLineage := barState.Lineage
|
||||||
|
|
||||||
// the foo lineage should be distinct from bar, and unchanged after
|
// the foo lineage should be distinct from bar, and unchanged after
|
||||||
// modifying bar
|
// modifying bar
|
||||||
fooState := terraform.NewState()
|
fooState := terraform.NewState()
|
||||||
|
// creating the named state may have created a lineage, so use that if it exists.
|
||||||
|
if s := foo.State(); s != nil && s.Lineage != "" {
|
||||||
|
fooState.Lineage = s.Lineage
|
||||||
|
}
|
||||||
fooLineage := fooState.Lineage
|
fooLineage := fooState.Lineage
|
||||||
|
|
||||||
// write a known state to foo
|
// write a known state to foo
|
||||||
|
|
Loading…
Reference in New Issue