From 7a2591190b685c07aacc18433bfd86ec85259f93 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 17 Sep 2014 17:52:24 -0700 Subject: [PATCH] terraform: fix graph test --- terraform/graph.go | 6 +++++- terraform/graph_test.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/terraform/graph.go b/terraform/graph.go index 478111a749..c0954a2c35 100644 --- a/terraform/graph.go +++ b/terraform/graph.go @@ -440,7 +440,11 @@ func graphAddDiff(g *depgraph.Graph, d *Diff) error { i-- case *GraphNodeResourceProvider: - // Keep these around + // Keep these around, but fix up the source to be ourselves + // rather than the old node. + newDep := *dep + newDep.Source = n + deps[i] = &newDep default: panic(fmt.Errorf("Unhandled depedency type: %#v", dep.Meta)) } diff --git a/terraform/graph_test.go b/terraform/graph_test.go index 15b15f637e..9d27b7cb69 100644 --- a/terraform/graph_test.go +++ b/terraform/graph_test.go @@ -334,7 +334,7 @@ func TestGraphAddDiff_destroy(t *testing.T) { actual := strings.TrimSpace(g.String()) expected := strings.TrimSpace(testTerraformGraphDiffDestroyStr) if actual != expected { - t.Fatalf("bad:\n\n%s", actual) + t.Fatalf("bad:\n\n%s\n\nexpected:\n\n%s", actual, expected) } // Verify that the state has been added