From feff10dcb5765042b9fc1f56e2e530bdf8466f64 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Sat, 13 Oct 2018 08:29:58 -0700 Subject: [PATCH] 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. --- command/graph_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/command/graph_test.go b/command/graph_test.go index 6cfcd1ee0f..b8712e6036 100644 --- a/command/graph_test.go +++ b/command/graph_test.go @@ -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)