genNodeList is used in testing to generate list of nodes
that could come up in cluster configurations. Since names
are used to assign indices to nodes, they have to be unique;
this is also the case in all real clusters.
Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Iustin Pop <iusty@k1024.org>
Reviewed-by: Guido Trotter <ultrotter@google.com>
-- lists here.
genNodeList :: Gen Node.Node -> Gen Node.List
genNodeList ngen = fmap (snd . Loader.assignIndices) names_nodes
- where names_nodes = (fmap . map) (\n -> (Node.name n, n)) $ listOf1 ngen
+ where names_nodes = (fmap . map) (\n -> (Node.name n, n)) nodes
+ nodes = listOf1 ngen `suchThat`
+ ((\ns -> ns == nub ns) . map Node.name)
-- | Generate a node list, an instance list, and a node graph.
-- We choose instances with nodes contained in the node list.