|
|
|
@ -161,7 +161,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
@mock.patch('tripleoclient.utils.copy_clouds_yaml') |
|
|
|
|
@mock.patch('tripleoclient.utils.get_undercloud_host_entry', autospec=True, |
|
|
|
|
return_value='192.168.0.1 uc.ctlplane.localhost uc.ctlplane') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_stack_network_matches_env_files') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_ceph_fsid_matches_env_files') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_swift_and_rgw') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_ceph_ansible') |
|
|
|
@ -177,7 +176,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
mock_create_tempest_deployer_input, |
|
|
|
|
mock_create_parameters_env, |
|
|
|
|
mock_breakpoints_cleanup, |
|
|
|
|
mock_events, mock_stack_network_check, |
|
|
|
|
mock_events, |
|
|
|
|
mock_ceph_fsid, mock_swift_rgw, |
|
|
|
|
mock_ceph_ansible, |
|
|
|
|
mock_get_undercloud_host_entry, mock_copy, |
|
|
|
@ -203,6 +202,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
clients = self.app.client_manager |
|
|
|
|
orchestration_client = clients.orchestration |
|
|
|
|
orchestration_client.stacks.get.return_value = fakes.create_tht_stack() |
|
|
|
|
utils_fixture.mock_launch_heat.return_value = orchestration_client |
|
|
|
|
mock_event = mock.Mock() |
|
|
|
|
mock_event.id = '1234' |
|
|
|
|
mock_events.return_value = [mock_events] |
|
|
|
@ -325,7 +325,9 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
mock_tmpdir.return_value = self.tmp_dir.path |
|
|
|
|
|
|
|
|
|
clients = self.app.client_manager |
|
|
|
|
|
|
|
|
|
orchestration_client = clients.orchestration |
|
|
|
|
orchestration_client.stacks.get.return_value = fakes.create_tht_stack() |
|
|
|
|
utils_fixture.mock_launch_heat.return_value = orchestration_client |
|
|
|
|
clients.network.api.find_attr.return_value = { |
|
|
|
|
"id": "network id" |
|
|
|
|
} |
|
|
|
@ -380,7 +382,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
@mock.patch('tripleoclient.utils.copy_clouds_yaml') |
|
|
|
|
@mock.patch('tripleoclient.utils.get_undercloud_host_entry', autospec=True, |
|
|
|
|
return_value='192.168.0.1 uc.ctlplane.localhost uc.ctlplane') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_stack_network_matches_env_files') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_ceph_fsid_matches_env_files') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_swift_and_rgw') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_ceph_ansible') |
|
|
|
@ -401,7 +402,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
mock_create_parameters_env, mock_validate_args, |
|
|
|
|
mock_validate_vip_file, |
|
|
|
|
mock_breakpoints_cleanup, |
|
|
|
|
mock_postconfig, mock_stack_network_check, |
|
|
|
|
mock_postconfig, |
|
|
|
|
mock_ceph_fsid, mock_swift_rgw, mock_ceph_ansible, |
|
|
|
|
mock_get_undercloud_host_entry, mock_copy, |
|
|
|
|
mock_chdir, |
|
|
|
@ -429,7 +430,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
clients = self.app.client_manager |
|
|
|
|
orchestration_client = clients.orchestration |
|
|
|
|
mock_stack = fakes.create_tht_stack() |
|
|
|
|
orchestration_client.stacks.get.side_effect = [None, mock_stack] |
|
|
|
|
orchestration_client.stacks.get.side_effect = [mock_stack] |
|
|
|
|
utils_fixture.mock_launch_heat.return_value = orchestration_client |
|
|
|
|
|
|
|
|
|
def _orch_clt_create(**kwargs): |
|
|
|
|
orchestration_client.stacks.get.return_value = mock_stack |
|
|
|
@ -478,7 +480,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
@mock.patch('tripleoclient.utils.copy_clouds_yaml') |
|
|
|
|
@mock.patch('tripleoclient.utils.get_undercloud_host_entry', autospec=True, |
|
|
|
|
return_value='192.168.0.1 uc.ctlplane.localhost uc.ctlplane') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_stack_network_matches_env_files') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_ceph_fsid_matches_env_files') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_swift_and_rgw') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_ceph_ansible') |
|
|
|
@ -495,7 +496,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
mock_create_tempest_deployer_input, |
|
|
|
|
mock_deploy_postconfig, |
|
|
|
|
mock_breakpoints_cleanup, |
|
|
|
|
mock_events, mock_stack_network_check, |
|
|
|
|
mock_events, |
|
|
|
|
mock_ceph_fsid, mock_swift_rgw, |
|
|
|
|
mock_ceph_ansible, |
|
|
|
|
mock_get_undercloud_host_entry, |
|
|
|
@ -513,13 +514,15 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
self.useFixture(fixture) |
|
|
|
|
utils_fixture = deployment.UtilsFixture() |
|
|
|
|
self.useFixture(utils_fixture) |
|
|
|
|
|
|
|
|
|
clients = self.app.client_manager |
|
|
|
|
orchestration_client = clients.orchestration |
|
|
|
|
orchestration_client.stacks.get.return_value = fakes.create_tht_stack() |
|
|
|
|
utils_fixture.mock_launch_heat.return_value = orchestration_client |
|
|
|
|
arglist = ['--templates', '/home/stack/tripleo-heat-templates'] |
|
|
|
|
verifylist = [ |
|
|
|
|
('templates', '/home/stack/tripleo-heat-templates'), |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
clients = self.app.client_manager |
|
|
|
|
mock_events.return_value = [] |
|
|
|
|
|
|
|
|
|
clients.network.api.find_attr.return_value = { |
|
|
|
@ -576,7 +579,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
autospec=True) |
|
|
|
|
@mock.patch('tripleoclient.utils.check_nic_config_with_ansible') |
|
|
|
|
@mock.patch('tripleoclient.utils.copy_clouds_yaml') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_stack_network_matches_env_files') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_ceph_fsid_matches_env_files') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_swift_and_rgw') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_ceph_ansible') |
|
|
|
@ -590,7 +592,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
'_heat_deploy', autospec=True) |
|
|
|
|
def test_environment_dirs(self, mock_deploy_heat, mock_create_env, |
|
|
|
|
mock_update_parameters, mock_post_config, |
|
|
|
|
mock_stack_network_check, mock_ceph_fsid, |
|
|
|
|
mock_ceph_fsid, |
|
|
|
|
mock_swift_rgw, mock_ceph_ansible, |
|
|
|
|
mock_copy, mock_nic_ansible, |
|
|
|
|
mock_process_env, mock_rc_params, |
|
|
|
@ -601,13 +603,12 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
self.useFixture(utils_overcloud_fixture) |
|
|
|
|
utils_fixture = deployment.UtilsFixture() |
|
|
|
|
self.useFixture(utils_fixture) |
|
|
|
|
|
|
|
|
|
clients = self.app.client_manager |
|
|
|
|
clients = self.app.client_manager |
|
|
|
|
orchestration_client = clients.orchestration |
|
|
|
|
orchestration_client.stacks.get.return_value = fakes.create_tht_stack() |
|
|
|
|
mock_update_parameters.return_value = {} |
|
|
|
|
utils_fixture.mock_launch_heat.return_value = orchestration_client |
|
|
|
|
utils_overcloud_fixture.mock_utils_endpoint.return_value = 'foo.bar' |
|
|
|
|
mock_update_parameters.return_value = {} |
|
|
|
|
|
|
|
|
|
test_env = os.path.join(self.tmp_dir.path, 'foo1.yaml') |
|
|
|
|
|
|
|
|
@ -637,7 +638,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
def assertEqual(*args): |
|
|
|
|
self.assertEqual(*args) |
|
|
|
|
|
|
|
|
|
def _fake_heat_deploy(self, stack, stack_name, template_path, |
|
|
|
|
def _fake_heat_deploy(self, stack_name, template_path, |
|
|
|
|
environments, timeout, tht_root, |
|
|
|
|
env, run_validations, |
|
|
|
|
roles_file, |
|
|
|
@ -724,12 +725,12 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
def test_try_overcloud_deploy_with_first_template_existing( |
|
|
|
|
self, mock_heat_deploy_func): |
|
|
|
|
result = self.cmd._try_overcloud_deploy_with_compat_yaml( |
|
|
|
|
'/fake/path', {}, 'overcloud', ['~/overcloud-env.json'], 1, |
|
|
|
|
'/fake/path', 'overcloud', ['~/overcloud-env.json'], 1, |
|
|
|
|
{}, False, None, None) |
|
|
|
|
# If it returns None it succeeded |
|
|
|
|
self.assertIsNone(result) |
|
|
|
|
mock_heat_deploy_func.assert_called_once_with( |
|
|
|
|
self.cmd, {}, 'overcloud', |
|
|
|
|
self.cmd, 'overcloud', |
|
|
|
|
'/fake/path/' + constants.OVERCLOUD_YAML_NAME, |
|
|
|
|
['~/overcloud-env.json'], 1, '/fake/path', {}, False, |
|
|
|
|
None, deployment_options=None, env_files_tracker=None) |
|
|
|
@ -741,7 +742,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
mock_heat_deploy_func.side_effect = oscexc.CommandError('error') |
|
|
|
|
self.assertRaises(ValueError, |
|
|
|
|
self.cmd._try_overcloud_deploy_with_compat_yaml, |
|
|
|
|
'/fake/path', mock.ANY, mock.ANY, |
|
|
|
|
'/fake/path', mock.ANY, |
|
|
|
|
mock.ANY, mock.ANY, mock.ANY, mock.ANY, mock.ANY, |
|
|
|
|
None) |
|
|
|
|
|
|
|
|
@ -753,7 +754,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
oscexc.CommandError('/fake/path not found') |
|
|
|
|
try: |
|
|
|
|
self.cmd._try_overcloud_deploy_with_compat_yaml( |
|
|
|
|
'/fake/path', mock.ANY, mock.ANY, |
|
|
|
|
'/fake/path', mock.ANY, |
|
|
|
|
mock.ANY, mock.ANY, mock.ANY, mock.ANY, mock.ANY, |
|
|
|
|
None) |
|
|
|
|
except ValueError as value_error: |
|
|
|
@ -802,7 +803,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
@mock.patch('tripleoclient.utils.copy_clouds_yaml') |
|
|
|
|
@mock.patch('tripleoclient.utils.get_undercloud_host_entry', autospec=True, |
|
|
|
|
return_value='192.168.0.1 uc.ctlplane.localhost uc.ctlplane') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_stack_network_matches_env_files') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_ceph_fsid_matches_env_files') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_swift_and_rgw') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_ceph_ansible') |
|
|
|
@ -811,7 +811,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
@mock.patch('tempfile.mkdtemp', autospec=True) |
|
|
|
|
@mock.patch('shutil.rmtree', autospec=True) |
|
|
|
|
def test_answers_file(self, mock_rmtree, mock_tmpdir, |
|
|
|
|
mock_heat_deploy, mock_stack_network_check, |
|
|
|
|
mock_heat_deploy, |
|
|
|
|
mock_ceph_fsid, mock_swift_rgw, |
|
|
|
|
mock_ceph_ansible, |
|
|
|
|
mock_get_undercloud_host_entry, |
|
|
|
@ -832,6 +832,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
self.useFixture(utils_oc_fixture) |
|
|
|
|
utils_fixture = deployment.UtilsFixture() |
|
|
|
|
self.useFixture(utils_fixture) |
|
|
|
|
utils_fixture.mock_launch_heat.return_value = orchestration_client |
|
|
|
|
|
|
|
|
|
clients = self.app.client_manager |
|
|
|
|
|
|
|
|
@ -884,17 +885,16 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
self.cmd.take_action(parsed_args) |
|
|
|
|
|
|
|
|
|
self.assertTrue(mock_heat_deploy.called) |
|
|
|
|
self.assertTrue(utils_oc_fixture.mock_deploy_tht.called) |
|
|
|
|
|
|
|
|
|
# Check that Heat was called with correct parameters: |
|
|
|
|
call_args = mock_heat_deploy.call_args[0] |
|
|
|
|
self.assertEqual(call_args[3], |
|
|
|
|
self.assertEqual(call_args[2], |
|
|
|
|
self.tmp_dir.join( |
|
|
|
|
'tripleo-heat-templates/overcloud.yaml')) |
|
|
|
|
self.assertEqual(call_args[6], |
|
|
|
|
self.assertEqual(call_args[5], |
|
|
|
|
self.tmp_dir.join('tripleo-heat-templates')) |
|
|
|
|
self.assertIn('Test', call_args[7]['resource_registry']) |
|
|
|
|
self.assertIn('Test2', call_args[7]['resource_registry']) |
|
|
|
|
self.assertIn('Test', call_args[6]['resource_registry']) |
|
|
|
|
self.assertIn('Test2', call_args[6]['resource_registry']) |
|
|
|
|
|
|
|
|
|
utils_oc_fixture.mock_deploy_tht.assert_called_with( |
|
|
|
|
output_dir=self.cmd.working_dir) |
|
|
|
@ -923,7 +923,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
@mock.patch('tripleoclient.utils.copy_clouds_yaml') |
|
|
|
|
@mock.patch('tripleoclient.utils.get_undercloud_host_entry', autospec=True, |
|
|
|
|
return_value='192.168.0.1 uc.ctlplane.localhost uc.ctlplane') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_stack_network_matches_env_files') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_ceph_fsid_matches_env_files') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_swift_and_rgw') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_ceph_ansible') |
|
|
|
@ -947,7 +946,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
mock_validate_vip_file, |
|
|
|
|
mock_breakpoints_cleanup, |
|
|
|
|
mock_deploy_post_config, |
|
|
|
|
mock_stack_network_check, |
|
|
|
|
mock_ceph_fsid, mock_swift_rgw, |
|
|
|
|
mock_ceph_ansible, |
|
|
|
|
mock_get_undercloud_host_entry, mock_copy, |
|
|
|
@ -976,9 +974,9 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
orchestration_client = clients.orchestration |
|
|
|
|
mock_stack = fakes.create_tht_stack() |
|
|
|
|
orchestration_client.stacks.get.side_effect = [ |
|
|
|
|
None, |
|
|
|
|
mock_stack |
|
|
|
|
] |
|
|
|
|
utils_fixture.mock_launch_heat.return_value = orchestration_client |
|
|
|
|
|
|
|
|
|
def _orch_clt_create(**kwargs): |
|
|
|
|
orchestration_client.stacks.get.return_value = mock_stack |
|
|
|
@ -1078,6 +1076,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
clients.compute = mock.Mock() |
|
|
|
|
orchestration_client = clients.orchestration |
|
|
|
|
orchestration_client.stacks.get.return_value = fakes.create_tht_stack() |
|
|
|
|
utils_fixture.mock_launch_heat.return_value = orchestration_client |
|
|
|
|
mock_create_env.return_value = ( |
|
|
|
|
dict(ContainerHeatApiImage='container-heat-api-image', |
|
|
|
|
ContainerHeatEngineImage='container-heat-engine-image'), |
|
|
|
@ -1111,6 +1110,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
clients = self.app.client_manager |
|
|
|
|
orchestration_client = clients.orchestration |
|
|
|
|
orchestration_client.stacks.get.return_value = fakes.create_tht_stack() |
|
|
|
|
utils_fixture.mock_launch_heat.return_value = orchestration_client |
|
|
|
|
|
|
|
|
|
arglist = ['--templates', '--config-download'] |
|
|
|
|
verifylist = [ |
|
|
|
@ -1156,6 +1156,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
clients = self.app.client_manager |
|
|
|
|
orchestration_client = clients.orchestration |
|
|
|
|
orchestration_client.stacks.get.return_value = fakes.create_tht_stack() |
|
|
|
|
utils_fixture.mock_launch_heat.return_value = orchestration_client |
|
|
|
|
mock_create_env.return_value = ({}, []) |
|
|
|
|
mock_create_env.return_value = ( |
|
|
|
|
dict(ContainerHeatApiImage='container-heat-api-image', |
|
|
|
@ -1202,6 +1203,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
clients = self.app.client_manager |
|
|
|
|
orchestration_client = clients.orchestration |
|
|
|
|
orchestration_client.stacks.get.return_value = fakes.create_tht_stack() |
|
|
|
|
utils_fixture.mock_launch_heat.return_value = orchestration_client |
|
|
|
|
mock_create_parameters_env.return_value = ( |
|
|
|
|
dict(ContainerHeatApiImage='container-heat-api-image', |
|
|
|
|
ContainerHeatEngineImage='container-heat-engine-image'), |
|
|
|
@ -1251,6 +1253,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
clients = self.app.client_manager |
|
|
|
|
orchestration_client = clients.orchestration |
|
|
|
|
orchestration_client.stacks.get.return_value = fakes.create_tht_stack() |
|
|
|
|
utils_fixture.mock_launch_heat.return_value = orchestration_client |
|
|
|
|
mock_create_parameters_env.return_value = ( |
|
|
|
|
dict(ContainerHeatApiImage='container-heat-api-image', |
|
|
|
|
ContainerHeatEngineImage='container-heat-engine-image'), |
|
|
|
@ -1299,6 +1302,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
clients = self.app.client_manager |
|
|
|
|
orchestration_client = clients.orchestration |
|
|
|
|
orchestration_client.stacks.get.return_value = fakes.create_tht_stack() |
|
|
|
|
utils_fixture.mock_launch_heat.return_value = orchestration_client |
|
|
|
|
|
|
|
|
|
arglist = ['--templates', |
|
|
|
|
'--override-ansible-cfg', 'ansible.cfg'] |
|
|
|
@ -1342,13 +1346,12 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
return_value='192.168.0.1 uc.ctlplane.localhost uc.ctlplane') |
|
|
|
|
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.' |
|
|
|
|
'_heat_deploy', autospec=True) |
|
|
|
|
@mock.patch('tripleoclient.utils.check_stack_network_matches_env_files') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_ceph_fsid_matches_env_files') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_swift_and_rgw') |
|
|
|
|
@mock.patch('tripleoclient.utils.check_ceph_ansible') |
|
|
|
|
@mock.patch('heatclient.common.template_utils.deep_update', autospec=True) |
|
|
|
|
def test_config_download_timeout( |
|
|
|
|
self, mock_hc, mock_stack_network_check, |
|
|
|
|
self, mock_hc, |
|
|
|
|
mock_ceph_fsid, mock_swift_rgw, mock_ceph_ansible, |
|
|
|
|
mock_hd, mock_get_undercloud_host_entry, mock_copy, |
|
|
|
|
mock_get_ctlplane_attrs, mock_nic_ansible, |
|
|
|
@ -1366,6 +1369,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
clients = self.app.client_manager |
|
|
|
|
orchestration_client = clients.orchestration |
|
|
|
|
orchestration_client.stacks.get.return_value = fakes.create_tht_stack() |
|
|
|
|
utils_fixture.mock_launch_heat.return_value = orchestration_client |
|
|
|
|
mock_create_parameters_env.return_value = [] |
|
|
|
|
|
|
|
|
|
arglist = ['--templates', '--overcloud-ssh-port-timeout', '42', |
|
|
|
@ -1395,7 +1399,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|
|
|
|
self.cmd.take_action(parsed_args) |
|
|
|
|
self.assertIn([ |
|
|
|
|
mock.call( |
|
|
|
|
mock.ANY, mock.ANY, 'overcloud', mock.ANY, |
|
|
|
|
mock.ANY, 'overcloud', mock.ANY, |
|
|
|
|
mock.ANY, 451, mock.ANY, |
|
|
|
|
{'parameter_defaults': { |
|
|
|
|
'ContainerHeatApiImage': 'container-heat-api-image', |
|
|
|
|