Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh during destroy #27408

Merged
merged 4 commits into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refresh is expected for destroy
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
commit e614fb9aed597252e6ca18244ca779e0d61d3683
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