def _check_chairmans_consistancy(self): """ Checks if chairman's in-memory view of the hierarchy is the same as the persisted view in zk. """ zk_root = get_hierarchy_from_zk(self.zk_client) chairmain_root = get_hierarchy_from_chairman(self.chairman_host, self.chairman_port, self.agent_host, self.agent_port) assert_that(zk_root, equal_to(chairmain_root))
def test_get_hierarchy_from_chairman(self): agent_host = "localhost" agent_port1 = 20000 agent_port2 = 20001 agent_port3 = 20002 agent_ids = self._start_agents(agent_host, [agent_port1, agent_port2, agent_port3]) _wait_for_configuration(self.root_sch_client, 2) root = get_hierarchy_from_chairman(self.chairman_host, self.chairman_port, self.root_host, self.root_port) agent_list = [ (agent_ids[0], agent_host, agent_port1), (agent_ids[1], agent_host, agent_port2), (agent_ids[2], agent_host, agent_port3), ] # verify the hierarchy structure self._check_tree(root, self.root_host, self.root_port, self.leaf_fanout, agent_list)
def test_get_hierarchy_from_chairman(self): agent_host = 'localhost' agent_port1 = 20000 agent_port2 = 20001 agent_port3 = 20002 agent_ids = self._start_agents(agent_host, [agent_port1, agent_port2, agent_port3]) _wait_for_configuration(self.root_sch_client, 2) root = get_hierarchy_from_chairman(self.chairman_host, self.chairman_port, self.root_host, self.root_port) agent_list = [(agent_ids[0], agent_host, agent_port1), (agent_ids[1], agent_host, agent_port2), (agent_ids[2], agent_host, agent_port3)] # verify the hierarchy structure self._check_tree(root, self.root_host, self.root_port, self.leaf_fanout, agent_list)