From 432331e484c1b6ddf2221d1044cb0bea503d9b48 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Fri, 1 Jun 2018 14:52:27 -0700 Subject: [PATCH] core: Fix TestContext2Refresh_dataState Now that we fetch schemas during NewContext, we need to configure the mock GetSchema method before constructing the context. --- terraform/context_refresh_test.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/terraform/context_refresh_test.go b/terraform/context_refresh_test.go index 75b947c4c2..62c30447f4 100644 --- a/terraform/context_refresh_test.go +++ b/terraform/context_refresh_test.go @@ -877,8 +877,8 @@ func TestContext2Refresh_dataOrphan(t *testing.T) { } func TestContext2Refresh_dataState(t *testing.T) { - p := testProvider("null") m := testModule(t, "refresh-data-resource-basic") + state := &State{ Modules: []*ModuleState{ &ModuleState{ @@ -890,16 +890,8 @@ func TestContext2Refresh_dataState(t *testing.T) { }, }, } - ctx := testContext2(t, &ContextOpts{ - Config: m, - ProviderResolver: ResourceProviderResolverFixed( - map[string]ResourceProviderFactory{ - "null": testProviderFuncFixed(p), - }, - ), - State: state, - }) + p := testProvider("null") p.GetSchemaReturn = &ProviderSchema{ Provider: &configschema.Block{}, DataSources: map[string]*configschema.Block{ @@ -914,6 +906,16 @@ func TestContext2Refresh_dataState(t *testing.T) { }, } + ctx := testContext2(t, &ContextOpts{ + Config: m, + ProviderResolver: ResourceProviderResolverFixed( + map[string]ResourceProviderFactory{ + "null": testProviderFuncFixed(p), + }, + ), + State: state, + }) + p.ReadDataDiffFn = nil p.ReadDataDiffReturn = &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{