mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
41 lines
789 B
Go
41 lines
789 B
Go
package terraform
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestCBDEdgeTransformer(t *testing.T) {
|
|
g := Graph{Path: RootModulePath}
|
|
g.Add(&graphNodeDestroyerTest{AddrString: "test.A"})
|
|
g.Add(&graphNodeDestroyerTest{AddrString: "test.B"})
|
|
|
|
{
|
|
tf := &DestroyEdgeTransformer{
|
|
Module: testModule(t, "transform-destroy-edge-basic"),
|
|
}
|
|
if err := tf.Transform(&g); err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
}
|
|
|
|
{
|
|
tf := &CBDEdgeTransformer{}
|
|
if err := tf.Transform(&g); err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
}
|
|
|
|
actual := strings.TrimSpace(g.String())
|
|
expected := strings.TrimSpace(testTransformCBDEdgeBasicStr)
|
|
if actual != expected {
|
|
t.Fatalf("bad:\n\n%s", actual)
|
|
}
|
|
}
|
|
|
|
const testTransformCBDEdgeBasicStr = `
|
|
test.A (destroy)
|
|
test.B (destroy)
|
|
test.B (destroy)
|
|
`
|