Skip to content

Commit

Permalink
refresh is expected for destroy
Browse files Browse the repository at this point in the history
These tests were not previously running a refresh, and hence did not
expect the resources to be read.
  • Loading branch information
jbardin committed Jan 8, 2021
1 parent 0b3b84a commit e614fb9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
16 changes: 2 additions & 14 deletions backend/local/backend_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ func TestLocal_planDestroy(t *testing.T) {
b, cleanup := TestLocal(t)
defer cleanup()

p := TestLocalProvider(t, b, "test", planFixtureSchema())
TestLocalProvider(t, b, "test", planFixtureSchema())
testStateFile(t, b.StatePath, testPlanState())

outDir := testTempDir(t)
Expand Down Expand Up @@ -593,10 +593,6 @@ func TestLocal_planDestroy(t *testing.T) {
t.Fatalf("plan operation failed")
}

if p.ReadResourceCalled {
t.Fatal("ReadResource should not be called")
}

if run.PlanEmpty {
t.Fatal("plan should not be empty")
}
Expand All @@ -613,7 +609,7 @@ func TestLocal_planDestroy_withDataSources(t *testing.T) {
b, cleanup := TestLocal(t)
defer cleanup()

p := TestLocalProvider(t, b, "test", planFixtureSchema())
TestLocalProvider(t, b, "test", planFixtureSchema())
testStateFile(t, b.StatePath, testPlanState_withDataSource())

b.CLI = cli.NewMockUi()
Expand Down Expand Up @@ -649,14 +645,6 @@ func TestLocal_planDestroy_withDataSources(t *testing.T) {
t.Fatalf("plan operation failed")
}

if p.ReadResourceCalled {
t.Fatal("ReadResource should not be called")
}

if p.ReadDataSourceCalled {
t.Fatal("ReadDataSourceCalled should not be called")
}

if run.PlanEmpty {
t.Fatal("plan should not be empty")
}
Expand Down
1 change: 1 addition & 0 deletions backend/local/testdata/destroy-with-ds/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
resource "test_instance" "foo" {
count = 1
ami = "bar"
}

Expand Down

0 comments on commit e614fb9

Please sign in to comment.