diff --git a/autopilot/prefattach_test.go b/autopilot/prefattach_test.go index 5801c00d..f485ce7d 100644 --- a/autopilot/prefattach_test.go +++ b/autopilot/prefattach_test.go @@ -376,6 +376,12 @@ func TestConstrainedPrefAttachmentSelectTwoVertexes(t *testing.T) { t1.Fatalf("unable to generate channel: %v", err) } + // We also add a third, non-connected node to the graph. + _, err = graph.addRandNode() + if err != nil { + t1.Fatalf("unable to add random node: %v", err) + } + // Get the score for all nodes found in the graph at // this point. nodes := make(map[NodeID]struct{}) @@ -386,7 +392,7 @@ func TestConstrainedPrefAttachmentSelectTwoVertexes(t *testing.T) { t1.Fatalf("unable to traverse graph: %v", err) } - if len(nodes) != 2 { + if len(nodes) != 3 { t1.Fatalf("expected 2 nodes, found %d", len(nodes)) } @@ -401,8 +407,10 @@ func TestConstrainedPrefAttachmentSelectTwoVertexes(t *testing.T) { "directives: %v", err) } - if len(candidates) != len(nodes) { - t1.Fatalf("all nodes should be scored, "+ + // We expect two candidates, since one of the nodes + // doesn't have any channels. + if len(candidates) != 2 { + t1.Fatalf("2 nodes should be scored, "+ "instead %v were", len(candidates)) }