Skip to content

Commit

Permalink
Merge pull request #15556 from hashicorp/jbardin/backend-tests
Browse files Browse the repository at this point in the history
backend state tests must honor lineage
  • Loading branch information
jbardin authored Jul 14, 2017
2 parents aa1e5e9 + 193d4b8 commit 87b2c0c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions backend/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 87b2c0c

Please sign in to comment.