terraform: test encoding module dependencies

This commit is contained in:
Armon Dadgar 2014-11-24 15:25:37 -08:00
parent 6af820f78b
commit 5376e05add
1 changed files with 10 additions and 1 deletions

View File

@ -945,7 +945,7 @@ func TestGraphEncodeDependencies_count(t *testing.T) {
func TestGraphEncodeDependencies_module(t *testing.T) {
m := testModule(t, "graph-modules")
g, err := Graph(&GraphOpts{Module: m})
g, err := Graph(&GraphOpts{Module: m, State: &State{}})
if err != nil {
t.Fatalf("err: %s", err)
}
@ -964,6 +964,15 @@ func TestGraphEncodeDependencies_module(t *testing.T) {
if web.Dependencies[1] != "module.consul" {
t.Fatalf("bad: %#v", web)
}
mod := g.Noun("module.consul").Meta.(*GraphNodeModule)
deps := mod.State.Dependencies
if len(deps) != 1 {
t.Fatalf("Bad: %#v", deps)
}
if deps[0] != "aws_security_group.firewall" {
t.Fatalf("Bad: %#v", deps)
}
}
func TestGraph_orphan_dependencies(t *testing.T) {