diff --git a/internal/command/graph_test.go b/internal/command/graph_test.go index b9e9b89aec..81dc266957 100644 --- a/internal/command/graph_test.go +++ b/internal/command/graph_test.go @@ -59,14 +59,15 @@ func TestGraph_cyclic(t *testing.T) { name string args []string expected string - errors []string + + // The cyclic errors do not maintain a consistent order, so we can't + // predict the exact output. We'll just check that the error messages + // are present for the things we know are cyclic. + errors []string }{ { name: "plan", args: []string{"-type=plan"}, - // The cyclic errors do not maintain a consistent order, so we can't - // predict the exact output. We'll just check that the error messages - // are present for the things we know are cyclic. errors: []string{`Error: Cycle: test_instance.`, `Error: Cycle: local.`}, }, diff --git a/internal/dag/dot.go b/internal/dag/dot.go index 36eb54db50..95129edda0 100644 --- a/internal/dag/dot.go +++ b/internal/dag/dot.go @@ -211,6 +211,7 @@ func (g *marshalGraph) writeBody(opts *DotOpts, w *indentWriter) { for _, e := range g.Edges { // only add the edge if it's not been added as part of a cycle + // or if there are duplicates. if _, ok := dotEdges[e.Name]; !ok { dotEdges[e.Name] = e.dot(g) }