CBD transformer test update

Comment out an out of date CBD test. The test no longer works due to
the CBD status being checked during plan, but the test case may still
have some value which we can review later.

update the text in the CBD transformer to reflect the
s/ancestor/descendent/ change.
This commit is contained in:
James Bardin 2018-09-25 19:22:19 -04:00 committed by Martin Atkins
parent 917a320a3b
commit 847c8d6244
2 changed files with 8 additions and 3 deletions

View File

@ -59,11 +59,11 @@ func (t *ForcedCBDTransformer) Transform(g *Graph) error {
// If there are no CBD decendent (dependent nodes), then we // If there are no CBD decendent (dependent nodes), then we
// do nothing here. // do nothing here.
if !t.hasCBDDescendent(g, v) { if !t.hasCBDDescendent(g, v) {
log.Printf("[TRACE] ForcedCBDTransformer: %q (%T) has no CBD ancestors, so skipping", dag.VertexName(v), v) log.Printf("[TRACE] ForcedCBDTransformer: %q (%T) has no CBD descendent, so skipping", dag.VertexName(v), v)
continue continue
} }
// If this isn't naturally a CBD node, this means that an ancestor is // If this isn't naturally a CBD node, this means that an descendent is
// and we need to auto-upgrade this node to CBD. We do this because // and we need to auto-upgrade this node to CBD. We do this because
// a CBD node depending on non-CBD will result in cycles. To avoid this, // a CBD node depending on non-CBD will result in cycles. To avoid this,
// we always attempt to upgrade it. // we always attempt to upgrade it.
@ -82,7 +82,7 @@ func (t *ForcedCBDTransformer) Transform(g *Graph) error {
return nil return nil
} }
// hasCBDAncestor returns true if any ancestor (node that depends on this) // hasCBDDescendent returns true if any descendent (node that depends on this)
// has CBD set. // has CBD set.
func (t *ForcedCBDTransformer) hasCBDDescendent(g *Graph, v dag.Vertex) bool { func (t *ForcedCBDTransformer) hasCBDDescendent(g *Graph, v dag.Vertex) bool {
s, _ := g.Descendents(v) s, _ := g.Descendents(v)

View File

@ -42,6 +42,10 @@ func TestCBDEdgeTransformer(t *testing.T) {
} }
} }
// FIXME: see if there is a worthwhile test to create from this.
// CBD is marked on created nodes during the plan phase now, and the
// CBDEdgeTransformer only takes care of the final edge reversal.
/*
func TestCBDEdgeTransformer_depNonCBD(t *testing.T) { func TestCBDEdgeTransformer_depNonCBD(t *testing.T) {
g := Graph{Path: addrs.RootModuleInstance} g := Graph{Path: addrs.RootModuleInstance}
g.Add(&graphNodeCreatorTest{AddrString: "test_object.A"}) g.Add(&graphNodeCreatorTest{AddrString: "test_object.A"})
@ -77,6 +81,7 @@ func TestCBDEdgeTransformer_depNonCBD(t *testing.T) {
t.Fatalf("wrong result\n\ngot:\n%s\n\nwant:\n%s", actual, expected) t.Fatalf("wrong result\n\ngot:\n%s\n\nwant:\n%s", actual, expected)
} }
} }
*/
func TestCBDEdgeTransformer_depNonCBDCount(t *testing.T) { func TestCBDEdgeTransformer_depNonCBDCount(t *testing.T) {
g := Graph{Path: addrs.RootModuleInstance} g := Graph{Path: addrs.RootModuleInstance}