def test_execute_prepare(self):
     op = DrydockNodesOperator(main_dag_name="main",
                               shipyard_conf=CONF_FILE,
                               task_id="t1")
     op.dc = copy.deepcopy(
         DeploymentConfigurationOperator.config_keys_defaults)
     op._setup_configured_values()
     op._execute_task = mock.MagicMock(return_value=TASK_RESULT)
     group = DeploymentGroup(GROUP_DICT, mock.MagicMock())
     group.actionable_nodes = ['node1', 'node2', 'node3']
     op._execute_prepare(group)
     assert op._execute_task.call_count == 1
Ejemplo n.º 2
0
 def test_execute_deployment_k8s_fail(self, cns, caplog):
     op = DrydockNodesOperator(main_dag_name="main",
                               shipyard_conf=CONF_FILE,
                               task_id="t1")
     op.dc = copy.deepcopy(
         DeploymentConfigurationOperator.config_keys_defaults)
     op._setup_configured_values()
     op._execute_task = mock.MagicMock(return_value=TASK_RESULT)
     op.join_wait = 0
     group = DeploymentGroup(GROUP_DICT, mock.MagicMock())
     group.actionable_nodes = ['node1', 'node2', 'node3']
     task_res = op._execute_deployment(group)
     op._execute_task.assert_called_once()
     cns.assert_called_once()
     assert 'node4 failed to join Kubernetes' in caplog.text
     assert len(task_res.successes) == 2