command: Fix TestGraph_plan

The plan file writer requires a backend config to be present, but we don't
really need one for the sake of _this_ test, since we don't activate the
backend to render a plan graph, and so we just write in a placeholder.
This commit is contained in:
Martin Atkins 2018-10-13 08:29:58 -07:00
parent c0baedac84
commit feff10dcb5
1 changed files with 12 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import (
"testing"
"github.com/mitchellh/cli"
"github.com/zclconf/go-cty/cty"
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/plans"
@ -126,6 +127,17 @@ func TestGraph_plan(t *testing.T) {
},
ProviderAddr: addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
})
emptyConfig, err := plans.NewDynamicValue(cty.EmptyObjectVal, cty.EmptyObject)
if err != nil {
t.Fatal(err)
}
plan.Backend = plans.Backend{
// Doesn't actually matter since we aren't going to activate the backend
// for this command anyway, but we need something here for the plan
// file writer to succeed.
Type: "placeholder",
Config: emptyConfig,
}
_, configSnap := testModuleWithSnapshot(t, "graph")
planPath := testPlanFile(t, configSnap, states.NewState(), plan)