add named named state delete+create-delete test

This ensures that we don't leave any conflicting state artifacts
preventing the recreation of a named state.
This commit is contained in:
James Bardin 2017-06-23 10:13:03 -04:00
parent c80a21610d
commit ebf4413e95

View File

@ -187,6 +187,24 @@ func testBackendStates(t *testing.T, b Backend) {
t.Fatal("expected error")
}
// Create and delete the foo state again.
// Make sure that there are no leftover artifacts from a deleted state
// preventing re-creation.
foo, err = b.State("foo")
if err != nil {
t.Fatalf("error: %s", err)
}
if err := foo.RefreshState(); err != nil {
t.Fatalf("bad: %s", err)
}
if v := foo.State(); v.HasResources() {
t.Fatalf("should be empty: %s", v)
}
// and delete it again
if err := b.DeleteState("foo"); err != nil {
t.Fatalf("err: %s", err)
}
// Verify deletion
{
states, err := b.States()