terraform: more destroy edge tests
This commit is contained in:
parent
7b2bd93094
commit
08dade5475
|
@ -0,0 +1,3 @@
|
|||
resource "test" "A" {}
|
||||
resource "test" "B" { value = "${test.A.value}" }
|
||||
resource "test" "C" { value = "${test.B.value}" }
|
|
@ -23,6 +23,25 @@ func TestDestroyEdgeTransformer(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestDestroyEdgeTransformer_multi(t *testing.T) {
|
||||
g := Graph{Path: RootModulePath}
|
||||
g.Add(&graphNodeDestroyerTest{AddrString: "test.A"})
|
||||
g.Add(&graphNodeDestroyerTest{AddrString: "test.B"})
|
||||
g.Add(&graphNodeDestroyerTest{AddrString: "test.C"})
|
||||
tf := &DestroyEdgeTransformer{
|
||||
Module: testModule(t, "transform-destroy-edge-multi"),
|
||||
}
|
||||
if err := tf.Transform(&g); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
actual := strings.TrimSpace(g.String())
|
||||
expected := strings.TrimSpace(testTransformDestroyEdgeMultiStr)
|
||||
if actual != expected {
|
||||
t.Fatalf("bad:\n\n%s", actual)
|
||||
}
|
||||
}
|
||||
|
||||
type graphNodeDestroyerTest struct {
|
||||
AddrString string
|
||||
}
|
||||
|
@ -42,3 +61,11 @@ test.A (destroy)
|
|||
test.B (destroy)
|
||||
test.B (destroy)
|
||||
`
|
||||
|
||||
const testTransformDestroyEdgeMultiStr = `
|
||||
test.A (destroy)
|
||||
test.B (destroy)
|
||||
test.B (destroy)
|
||||
test.C (destroy)
|
||||
test.C (destroy)
|
||||
`
|
||||
|
|
Loading…
Reference in New Issue