def test_git_post_install_systemd(self, check_call, rmtree, copytree, symlink, exists, join, listdir): projects_yaml = openstack_origin_git join.return_value = 'joined-string' self.lsb_release.return_value = {'DISTRIB_RELEASE': '15.10'} self.git_pip_venv_dir.return_value = '/mnt/openstack-git/venv' utils.git_post_install(projects_yaml) expected = [ call('git/nova-compute-kvm.conf', '/etc/nova/nova-compute.conf', {}, perms=420), call('git/nova_sudoers', '/etc/sudoers.d/nova_sudoers', {}, perms=288), call('git/nova-api.init.in.template', 'joined-string', {'daemon_path': 'joined-string'}, perms=420), call('git/nova-api-metadata.init.in.template', 'joined-string', {'daemon_path': 'joined-string'}, perms=420), call('git/nova-compute.init.in.template', 'joined-string', {'daemon_path': 'joined-string'}, perms=420), call('git/nova-network.init.in.template', 'joined-string', {'daemon_path': 'joined-string'}, perms=420), ] self.assertEqual(self.render.call_args_list, expected)
def test_git_post_install_upstart(self, check_call, rmtree, copytree, symlink, exists, join): projects_yaml = openstack_origin_git join.return_value = 'joined-string' self.lsb_release.return_value = {'DISTRIB_RELEASE': '15.04'} self.git_pip_venv_dir.return_value = '/mnt/openstack-git/venv' utils.git_post_install(projects_yaml) expected = [ call('joined-string', '/etc/nova'), ] copytree.assert_has_calls(expected) expected = [ call('joined-string', '/usr/local/bin/nova-rootwrap'), ] symlink.assert_has_calls(expected, any_order=True) service_name = 'nova-compute' nova_user = '******' start_dir = '/var/lib/nova' nova_conf = '/etc/nova/nova.conf' nova_api_metadata_context = { 'service_description': 'Nova Metadata API server', 'service_name': service_name, 'user_name': nova_user, 'start_dir': start_dir, 'process_name': 'nova-api-metadata', 'executable_name': 'joined-string', 'config_files': [nova_conf], } nova_api_context = { 'service_description': 'Nova API server', 'service_name': service_name, 'user_name': nova_user, 'start_dir': start_dir, 'process_name': 'nova-api', 'executable_name': 'joined-string', 'config_files': [nova_conf], } nova_compute_context = { 'service_description': 'Nova compute worker', 'service_name': service_name, 'user_name': nova_user, 'process_name': 'nova-compute', 'executable_name': 'joined-string', 'config_files': [nova_conf, '/etc/nova/nova-compute.conf'], } nova_network_context = { 'service_description': 'Nova network worker', 'service_name': service_name, 'user_name': nova_user, 'start_dir': start_dir, 'process_name': 'nova-network', 'executable_name': 'joined-string', 'config_files': [nova_conf], } expected = [ call('git/nova-compute-kvm.conf', '/etc/nova/nova-compute.conf', {}, perms=0o644), call('git/nova_sudoers', '/etc/sudoers.d/nova_sudoers', {}, perms=0o440), call('git.upstart', '/etc/init/nova-api-metadata.conf', nova_api_metadata_context, perms=0o644, templates_dir='joined-string'), call('git.upstart', '/etc/init/nova-api.conf', nova_api_context, perms=0o644, templates_dir='joined-string'), call('git/upstart/nova-compute.upstart', '/etc/init/nova-compute.conf', nova_compute_context, perms=420), call('git.upstart', '/etc/init/nova-network.conf', nova_network_context, perms=0o644, templates_dir='joined-string'), ] self.assertEqual(self.render.call_args_list, expected) self.assertTrue(self.apt_update.called) self.apt_install.assert_called_with([ 'bridge-utils', 'dnsmasq-base', 'dnsmasq-utils', 'ebtables', 'genisoimage', 'iptables', 'iputils-arping', 'kpartx', 'kvm', 'netcat', 'open-iscsi', 'parted', 'python-libvirt', 'qemu', 'qemu-system', 'qemu-utils', 'vlan', 'xen-system-amd64' ], fatal=True)
def test_git_post_install_upstart(self, check_call, rmtree, copytree, symlink, exists, join): projects_yaml = openstack_origin_git join.return_value = 'joined-string' self.lsb_release.return_value = {'DISTRIB_RELEASE': '15.04'} self.git_pip_venv_dir.return_value = '/mnt/openstack-git/venv' utils.git_post_install(projects_yaml) expected = [ call('joined-string', '/etc/nova'), ] copytree.assert_has_calls(expected) expected = [ call('joined-string', '/usr/local/bin/nova-rootwrap'), ] symlink.assert_has_calls(expected, any_order=True) service_name = 'nova-compute' nova_user = '******' start_dir = '/var/lib/nova' nova_conf = '/etc/nova/nova.conf' nova_api_metadata_context = { 'service_description': 'Nova Metadata API server', 'service_name': service_name, 'user_name': nova_user, 'start_dir': start_dir, 'process_name': 'nova-api-metadata', 'executable_name': 'joined-string', 'config_files': [nova_conf], } nova_api_context = { 'service_description': 'Nova API server', 'service_name': service_name, 'user_name': nova_user, 'start_dir': start_dir, 'process_name': 'nova-api', 'executable_name': 'joined-string', 'config_files': [nova_conf], } nova_compute_context = { 'service_description': 'Nova compute worker', 'service_name': service_name, 'user_name': nova_user, 'process_name': 'nova-compute', 'executable_name': 'joined-string', 'config_files': [nova_conf, '/etc/nova/nova-compute.conf'], } nova_network_context = { 'service_description': 'Nova network worker', 'service_name': service_name, 'user_name': nova_user, 'start_dir': start_dir, 'process_name': 'nova-network', 'executable_name': 'joined-string', 'config_files': [nova_conf], } expected = [ call('git/nova-compute-kvm.conf', '/etc/nova/nova-compute.conf', {}, perms=0o644), call('git/nova_sudoers', '/etc/sudoers.d/nova_sudoers', {}, perms=0o440), call('git.upstart', '/etc/init/nova-api-metadata.conf', nova_api_metadata_context, perms=0o644, templates_dir='joined-string'), call('git.upstart', '/etc/init/nova-api.conf', nova_api_context, perms=0o644, templates_dir='joined-string'), call('git/upstart/nova-compute.upstart', '/etc/init/nova-compute.conf', nova_compute_context, perms=420), call('git.upstart', '/etc/init/nova-network.conf', nova_network_context, perms=0o644, templates_dir='joined-string'), ] self.assertEqual(self.render.call_args_list, expected) self.assertTrue(self.apt_update.called) self.apt_install.assert_called_with( ['bridge-utils', 'dnsmasq-base', 'dnsmasq-utils', 'ebtables', 'genisoimage', 'iptables', 'iputils-arping', 'kpartx', 'kvm', 'netcat', 'open-iscsi', 'parted', 'python-libvirt', 'qemu', 'qemu-system', 'qemu-utils', 'vlan', 'xen-system-amd64'], fatal=True)