backend state tests must honor lineage
Remote state implementations may initialize a lineage when creating a new named state (i.e. "workspace"). The tests were ignoring that initial lineage to write a new state to the backend.
This commit is contained in:
parent
8e2ee53ed3
commit
193d4b868c
|
@ -92,11 +92,20 @@ func testBackendStates(t *testing.T, b Backend) {
|
|||
// start with a fresh state, and record the lineage being
|
||||
// written to "bar"
|
||||
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
|
||||
|
||||
// the foo lineage should be distinct from bar, and unchanged after
|
||||
// modifying bar
|
||||
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
|
||||
|
||||
// write a known state to foo
|
||||
|
|
Loading…
Reference in New Issue