def test_can_find_node_by_name(self): node = Node(name="node2", ip_address="192.123.3.3", port=2312) NodeRepository.save(node) node_by_name = NodeRepository.by_name("node2") assert_that(node_by_name.name, is_("node2")) assert_that(node_by_name.ip_address, is_("192.123.3.3"))
def add_node(name, ip_address, port): NodeRepository.save(Node(name=name, ip_address=ip_address, port=port))
def test_can_store_a_node(self): node = Node(name="node1", ip_address="192.123.3.3", port=2312) NodeRepository.save(node) assert_that(NodeRepository.all()[0].name, is_("node1")) assert_that(NodeRepository.all()[0].ip_address, is_("192.123.3.3"))
def get_node_stats(node_name): node = NodeRepository.by_name(node_name) data = DataCollector.get_node_info(node) StatsRepository.save_for_node(node, data)
def node_by_name(name): return NodeRepository.by_name(name)
def list_nodes(): return NodeRepository.all()