update missing provider transform test

The CloserProviderTransformer requires that the resources be connected
to their provider first, so that it cen get the correct dependencies,
and adding the ProviderTransformer changed the test output slightly.
This commit is contained in:
James Bardin 2017-11-02 09:38:15 -04:00
parent 8388dfd2f9
commit 12a4a29cbd
2 changed files with 11 additions and 2 deletions

View File

@ -121,7 +121,7 @@ func (t *CloseProviderTransformer) Transform(g *Graph) error {
// connect all the provider's resources to the close node
for _, s := range g.UpEdges(p).List() {
if _, ok := s.(GraphNodeResource); ok {
if _, ok := s.(GraphNodeProviderConsumer); ok {
g.Connect(dag.BasicEdge(closer, s))
}
}

View File

@ -178,6 +178,13 @@ func TestMissingProviderTransformer(t *testing.T) {
}
}
{
transform := &ProviderTransformer{}
if err := transform.Transform(&g); err != nil {
t.Fatalf("err: %s", err)
}
}
{
transform := &CloseProviderTransformer{}
if err := transform.Transform(&g); err != nil {
@ -188,7 +195,7 @@ func TestMissingProviderTransformer(t *testing.T) {
actual := strings.TrimSpace(g.String())
expected := strings.TrimSpace(testTransformMissingProviderBasicStr)
if actual != expected {
t.Fatalf("bad:\n\n%s", actual)
t.Fatalf("expected:\n%s\n\ngot:\n%s", expected, actual)
}
}
@ -413,7 +420,9 @@ provider.aws (close)
const testTransformMissingProviderBasicStr = `
aws_instance.web
provider.aws
foo_instance.web
provider.foo
provider.aws
provider.aws (close)
aws_instance.web