def setUp(self): super(CellsManagerClassTestCase, self).setUp() fakes.init(self) # pick a child cell to use for tests. self.our_cell = 'grandchild-cell1' self.cells_manager = fakes.get_cells_manager(self.our_cell) self.msg_runner = self.cells_manager.msg_runner self.driver = self.cells_manager.driver self.ctxt = 'fake_context'
def _setup_attrs(self, source_cell, target_cell): self.tgt_cell_name = target_cell self.src_msg_runner = fakes.get_message_runner(source_cell) self.src_state_manager = self.src_msg_runner.state_manager tgt_shortname = target_cell.split('!')[-1] self.tgt_cell_mgr = fakes.get_cells_manager(tgt_shortname) self.tgt_msg_runner = self.tgt_cell_mgr.msg_runner self.tgt_scheduler = self.tgt_msg_runner.scheduler self.tgt_state_manager = self.tgt_msg_runner.state_manager methods_cls = self.tgt_msg_runner.methods_by_type['targeted'] self.tgt_methods_cls = methods_cls self.tgt_compute_api = methods_cls.compute_api self.tgt_db_inst = methods_cls.db
def test_post_start_hook_middle_cell(self): cells_manager = fakes.get_cells_manager('child-cell2') msg_runner = cells_manager.msg_runner driver = cells_manager.driver self.mox.StubOutWithMock(driver, 'start_servers') self.mox.StubOutWithMock(context, 'get_admin_context') self.mox.StubOutWithMock(msg_runner, 'ask_children_for_capabilities') self.mox.StubOutWithMock(msg_runner, 'ask_children_for_capacities') driver.start_servers(msg_runner) context.get_admin_context().AndReturn(self.ctxt) msg_runner.ask_children_for_capabilities(self.ctxt) msg_runner.ask_children_for_capacities(self.ctxt) self.mox.ReplayAll() cells_manager.post_start_hook()
def test_post_start_hook_middle_cell(self): cells_manager = fakes.get_cells_manager("child-cell2") msg_runner = cells_manager.msg_runner driver = cells_manager.driver self.mox.StubOutWithMock(driver, "start_servers") self.mox.StubOutWithMock(context, "get_admin_context") self.mox.StubOutWithMock(msg_runner, "ask_children_for_capabilities") self.mox.StubOutWithMock(msg_runner, "ask_children_for_capacities") driver.start_servers(msg_runner) context.get_admin_context().AndReturn(self.ctxt) msg_runner.ask_children_for_capabilities(self.ctxt) msg_runner.ask_children_for_capacities(self.ctxt) self.mox.ReplayAll() cells_manager.post_start_hook()