terraform: get tests to not panic on failures

This commit is contained in:
Mitchell Hashimoto 2016-09-16 14:48:40 -07:00
parent 0463ad74a8
commit 0e666aa575
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
2 changed files with 6 additions and 20 deletions

View File

@ -1759,6 +1759,8 @@ func TestContext2Apply_multiVar(t *testing.T) {
t.Fatalf("bad: \n%s", actual) t.Fatalf("bad: \n%s", actual)
} }
t.Logf("Initial state: %s", state.String())
// Apply again, reduce the count to 1 // Apply again, reduce the count to 1
{ {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
@ -1782,6 +1784,10 @@ func TestContext2Apply_multiVar(t *testing.T) {
} }
actual := state.RootModule().Outputs["output"] actual := state.RootModule().Outputs["output"]
if actual == nil {
t.Fatal("missing output")
}
expected := "bar0" expected := "bar0"
if actual.Value != expected { if actual.Value != expected {
t.Fatalf("bad: \n%s", actual) t.Fatalf("bad: \n%s", actual)

View File

@ -1,10 +1,7 @@
package terraform package terraform
import ( import (
"log"
"github.com/hashicorp/terraform/config/module" "github.com/hashicorp/terraform/config/module"
"github.com/hashicorp/terraform/dag"
) )
// OutputTransformer is a GraphTransformer that adds all the outputs // OutputTransformer is a GraphTransformer that adds all the outputs
@ -42,9 +39,6 @@ func (t *OutputTransformer) transform(g *Graph, m *module.Tree) error {
return nil return nil
} }
// Build the reference map so we can determine if we're referencing things.
refMap := NewReferenceMap(g.Vertices())
// Add all outputs here // Add all outputs here
for _, o := range os { for _, o := range os {
// Build the node. // Build the node.
@ -57,20 +51,6 @@ func (t *OutputTransformer) transform(g *Graph, m *module.Tree) error {
Config: o, Config: o,
} }
// If the node references something, then we check to make sure
// that the thing it references is in the graph. If it isn't, then
// we don't add it because we may not be able to compute the output.
//
// If the node references nothing, we always include it since there
// is no other clear time to compute it.
matches, missing := refMap.References(node)
if len(missing) > 0 {
log.Printf(
"[INFO] Not including %q in graph, matches: %v, missing: %s",
dag.VertexName(node), matches, missing)
continue
}
// Add it! // Add it!
g.Add(node) g.Add(node)
} }