core: Don't panic in refresh tests

Since the refresh walk creates a partial plan to account for objects that
are yet to be created, we need to provide at least a basic mock of the
PlanProviderChange provider method.

For now we're using the old-style "DiffFn" shim interface since that's
already available for use in other tests.
This commit is contained in:
Martin Atkins 2018-09-06 15:08:47 -07:00
parent 70c555cfd3
commit 9c4aed52b3
1 changed files with 10 additions and 0 deletions

View File

@ -789,6 +789,11 @@ func TestContext2Refresh_outputPartial(t *testing.T) {
p.ReadResourceFn = nil
p.ReadResourceResponse = providers.ReadResourceResponse{}
// Refresh creates a partial plan for any instances that don't have
// remote objects yet, to get stub values for interpolation. Therefore
// we need to make DiffFn available to let that complete.
p.DiffFn = testDiffFn
p.GetSchemaReturn = &ProviderSchema{
Provider: &configschema.Block{},
ResourceTypes: map[string]*configschema.Block{
@ -1395,6 +1400,11 @@ func TestContext2Refresh_noDiffHookOnScaleOut(t *testing.T) {
},
}
// Refresh creates a partial plan for any instances that don't have
// remote objects yet, to get stub values for interpolation. Therefore
// we need to make DiffFn available to let that complete.
p.DiffFn = testDiffFn
state := mustShimLegacyState(&State{
Modules: []*ModuleState{
&ModuleState{