|
|
|
|
@ -5,6 +5,8 @@ import (
|
|
|
|
|
"strings"
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/hashicorp/terraform/config"
|
|
|
|
|
"github.com/hashicorp/terraform/terraform"
|
|
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ -70,3 +72,27 @@ func TestGraph_noArgs(t *testing.T) {
|
|
|
|
|
t.Fatalf("doesn't look like digraph: %s", output)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestGraph_plan(t *testing.T) {
|
|
|
|
|
planPath := testPlanFile(t, &terraform.Plan{
|
|
|
|
|
Config: new(config.Config),
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
ui := new(cli.MockUi)
|
|
|
|
|
c := &GraphCommand{
|
|
|
|
|
ContextOpts: testCtxConfig(testProvider()),
|
|
|
|
|
Ui: ui,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
args := []string{
|
|
|
|
|
planPath,
|
|
|
|
|
}
|
|
|
|
|
if code := c.Run(args); code != 0 {
|
|
|
|
|
t.Fatalf("bad: \n%s", ui.ErrorWriter.String())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
output := ui.OutputWriter.String()
|
|
|
|
|
if !strings.Contains(output, "digraph {") {
|
|
|
|
|
t.Fatalf("doesn't look like digraph: %s", output)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|