diff --git a/terraform/context_apply_test.go b/terraform/context_apply_test.go index f5b28da2b..071c80db9 100644 --- a/terraform/context_apply_test.go +++ b/terraform/context_apply_test.go @@ -267,7 +267,6 @@ func TestContext2Apply_resourceDependsOnModule(t *testing.T) { } if !reflect.DeepEqual(order, []string{"child", "parent"}) { - fmt.Println("ORDER:", order) t.Fatal("resources applied out of order") } diff --git a/terraform/node_resource_plan_orphan_test.go b/terraform/node_resource_plan_orphan_test.go index 45078cd43..f4396448e 100644 --- a/terraform/node_resource_plan_orphan_test.go +++ b/terraform/node_resource_plan_orphan_test.go @@ -33,6 +33,7 @@ func TestNodeResourcePlanOrphanExecute(t *testing.T) { p := simpleMockProvider() ctx := &MockEvalContext{ StateState: state.SyncWrapper(), + RefreshStateState: state.SyncWrapper(), InstanceExpanderExpander: instances.NewExpander(), ProviderProvider: p, ProviderSchemaSchema: &ProviderSchema{ diff --git a/terraform/provider_mock.go b/terraform/provider_mock.go index 45397fe22..bf3aca327 100644 --- a/terraform/provider_mock.go +++ b/terraform/provider_mock.go @@ -242,14 +242,20 @@ func (p *MockProvider) ReadResource(r providers.ReadResourceRequest) providers.R return p.ReadResourceFn(r) } - // make sure the NewState fits the schema - newState, err := p.GetSchemaReturn.ResourceTypes[r.TypeName].CoerceValue(p.ReadResourceResponse.NewState) - if err != nil { - panic(err) - } resp := p.ReadResourceResponse - resp.NewState = newState + if resp.NewState != cty.NilVal { + // make sure the NewState fits the schema + // This isn't always the case for the existing tests + newState, err := p.GetSchemaReturn.ResourceTypes[r.TypeName].CoerceValue(resp.NewState) + if err != nil { + panic(err) + } + resp.NewState = newState + return resp + } + // just return the same state we received + resp.NewState = r.PriorState return resp }