def _get_nodes(self): containers = ContainerManager.get_containers_by_prefix(self.node_prefix) for node_index, container in sorted((int(c.labels["NodeIndex"]), c) for c in containers): LOGGER.debug("Found container %s with name `%s' and index=%d", container, container.name, node_index) node = self._create_node(node_index, container) self.nodes.append(node) return self.nodes
def test_get_containers_by_prefix(self): self.assertEqual(ContainerManager.get_containers_by_prefix("blah"), ((), {"all": True, "filters": {"name": "blah"}, }, ))