From 847c8d6244c60c1f100dc08f2012c0137e50ff05 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 25 Sep 2018 19:22:19 -0400 Subject: [PATCH] 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. --- terraform/transform_destroy_cbd.go | 6 +++--- terraform/transform_destroy_cbd_test.go | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/terraform/transform_destroy_cbd.go b/terraform/transform_destroy_cbd.go index 570b2ba54..2f4d5edeb 100644 --- a/terraform/transform_destroy_cbd.go +++ b/terraform/transform_destroy_cbd.go @@ -59,11 +59,11 @@ func (t *ForcedCBDTransformer) Transform(g *Graph) error { // If there are no CBD decendent (dependent nodes), then we // do nothing here. 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 } - // 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 // a CBD node depending on non-CBD will result in cycles. To avoid this, // we always attempt to upgrade it. @@ -82,7 +82,7 @@ func (t *ForcedCBDTransformer) Transform(g *Graph) error { 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. func (t *ForcedCBDTransformer) hasCBDDescendent(g *Graph, v dag.Vertex) bool { s, _ := g.Descendents(v) diff --git a/terraform/transform_destroy_cbd_test.go b/terraform/transform_destroy_cbd_test.go index 5a830fe1f..665d81647 100644 --- a/terraform/transform_destroy_cbd_test.go +++ b/terraform/transform_destroy_cbd_test.go @@ -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) { g := Graph{Path: addrs.RootModuleInstance} 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) } } +*/ func TestCBDEdgeTransformer_depNonCBDCount(t *testing.T) { g := Graph{Path: addrs.RootModuleInstance}