def test_preparesite(self, input_files, deckhand_ingester, setup, drydock_state): input_file = input_files.join("deckhand_fullsite.yaml") design_ref = "file://%s" % str(input_file) # Build a dummy object that looks like an oslo_config object # so the orchestrator is configured w/ Noop drivers class DummyConf(object): oob_driver = list() node_driver = 'drydock_provisioner.drivers.node.driver.NodeDriver' network_driver = None orchestrator = orch.Orchestrator(enabled_drivers=DummyConf(), state_manager=drydock_state, ingester=deckhand_ingester) task = orchestrator.create_task( design_ref=design_ref, action=hd_fields.OrchestratorAction.PrepareSite) action = PrepareSite(task, orchestrator, drydock_state) action.start() task = drydock_state.get_task(task.get_id()) assert task.result.status == hd_fields.ActionResult.Success
def test_task_termination(self, setup, blank_state): ingester = Ingester() ingester.enable_plugin( 'drydock_provisioner.ingester.plugins.yaml.YamlIngester') orchestrator = orch.Orchestrator(state_manager=blank_state, ingester=ingester) orch_task = orchestrator.create_task( action=hd_fields.OrchestratorAction.Noop) orch_task.set_status(hd_fields.TaskStatus.Queued) orch_task.save() orch_thread = threading.Thread(target=orchestrator.watch_for_tasks) orch_thread.start() try: time.sleep(2) orchestrator.terminate_task(orch_task) time.sleep(10) orch_task = blank_state.get_task(orch_task.get_id()) assert orch_task.get_status() == hd_fields.TaskStatus.Terminated finally: orchestrator.stop_orchestrator() orch_thread.join(10)
def test_preparenodes(self, input_files, deckhand_ingester, setup, drydock_state): input_file = input_files.join("deckhand_fullsite.yaml") design_ref = "file://%s" % str(input_file) # Build a dummy object that looks like an oslo_config object # so the orchestrator is configured w/ Noop drivers class DummyConf(object): oob_driver = ['drydock_provisioner.drivers.oob.driver.OobDriver'] node_driver = 'drydock_provisioner.drivers.node.driver.NodeDriver' network_driver = None orchestrator = orch.Orchestrator(enabled_drivers=DummyConf(), state_manager=drydock_state, ingester=deckhand_ingester) task = orchestrator.create_task( design_ref=design_ref, action=hd_fields.OrchestratorAction.PrepareNodes) action = PrepareNodes(task, orchestrator, drydock_state) action.start() task = drydock_state.get_task(task.get_id()) assert task.result.status == hd_fields.ActionResult.Success # check that the PrepareNodes action was split # with 2 nodes in the definition assert len(task.subtask_id_list) == 2 for st_id in task.subtask_id_list: st = drydock_state.get_task(st_id) assert st.action == hd_fields.OrchestratorAction.PrepareNodes
def test_task_termination(self, input_files, deckhand_ingester, setup, blank_state): input_file = input_files.join("deckhand_fullsite.yaml") design_ref = "file://%s" % str(input_file) orchestrator = orch.Orchestrator(state_manager=blank_state, ingester=deckhand_ingester) orch_task = orchestrator.create_task( action=hd_fields.OrchestratorAction.Noop, design_ref=design_ref) orch_task.set_status(hd_fields.TaskStatus.Queued) orch_task.save() orch_thread = threading.Thread(target=orchestrator.watch_for_tasks) orch_thread.start() try: time.sleep(2) orchestrator.terminate_task(orch_task) time.sleep(10) orch_task = blank_state.get_task(orch_task.get_id()) assert orch_task.get_status() == hd_fields.TaskStatus.Terminated finally: orchestrator.stop_orchestrator() orch_thread.join(10)