core: Fix TestContext2Plan_moduleVariableFromSplat

The weird special-case behaviors of testDiffFn were interfering with the
outcome of this test, but we don't actually need any of those special
behaviors here so we'll use a very simple PlanResourceChangeFn
implementation instead, just letting the built-in merge behavior in core
take care of it.
This commit is contained in:
Martin Atkins 2018-09-27 18:17:06 -07:00
parent b229264bd6
commit 620f04af73
2 changed files with 44 additions and 38 deletions

View File

@ -4874,7 +4874,6 @@ func TestContext2Plan_moduleVariableFromSplat(t *testing.T) {
func TestContext2Plan_createBeforeDestroy_depends_datasource(t *testing.T) {
m := testModule(t, "plan-cbd-depends-datasource")
p := testProvider("aws")
p.DiffFn = testDiffFn
p.GetSchemaReturn = &ProviderSchema{
ResourceTypes: map[string]*configschema.Block{
"aws_instance": {
@ -4893,6 +4892,11 @@ func TestContext2Plan_createBeforeDestroy_depends_datasource(t *testing.T) {
},
},
}
p.PlanResourceChangeFn = func (req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {
return providers.PlanResourceChangeResponse{
PlannedState: req.ProposedNewState,
}
}
ctx := testContext2(t, &ContextOpts{
Config: m,
@ -4922,6 +4926,7 @@ func TestContext2Plan_createBeforeDestroy_depends_datasource(t *testing.T) {
t.Fatal(err)
}
t.Run(ric.Addr.String(), func (t *testing.T) {
switch i := ric.Addr.String(); i {
case "aws_instance.foo[0]":
if res.Action != plans.Create {
@ -4958,6 +4963,7 @@ func TestContext2Plan_createBeforeDestroy_depends_datasource(t *testing.T) {
default:
t.Fatal("unknown instance:", i)
}
})
}
}