2012-03-16 17:45:06 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'nova' do
|
2012-04-01 14:31:09 -07:00
|
|
|
|
2012-03-16 17:45:06 +01:00
|
|
|
let :facts do
|
|
|
|
{ :osfamily => 'Debian' }
|
2012-03-30 01:09:50 -07:00
|
|
|
end
|
2012-03-16 17:45:06 +01:00
|
|
|
|
2012-03-30 23:36:52 -07:00
|
|
|
describe 'with default parameters' do
|
|
|
|
it { should contain_package('python').with_ensure('present') }
|
|
|
|
it { should contain_package('python-greenlet').with(
|
2012-03-16 17:45:06 +01:00
|
|
|
'ensure' => 'present',
|
2012-03-30 23:36:52 -07:00
|
|
|
'require' => 'Package[python]'
|
|
|
|
)}
|
|
|
|
it { should contain_package('python-nova').with(
|
|
|
|
'ensure' => 'present',
|
|
|
|
'require' => 'Package[python-greenlet]'
|
|
|
|
)}
|
2012-05-09 16:54:09 -07:00
|
|
|
it { should contain_package('nova-common').with(
|
|
|
|
'name' => 'nova-common',
|
|
|
|
'ensure' => 'present'
|
|
|
|
)}
|
2012-03-30 23:36:52 -07:00
|
|
|
|
|
|
|
it { should contain_group('nova').with(
|
|
|
|
'ensure' => 'present',
|
|
|
|
'system' => 'true',
|
|
|
|
'require' => 'Package[nova-common]'
|
|
|
|
)}
|
|
|
|
|
|
|
|
it { should contain_user('nova').with(
|
|
|
|
'ensure' => 'present',
|
|
|
|
'gid' => 'nova',
|
|
|
|
'system' => 'true',
|
|
|
|
'require' => 'Package[nova-common]'
|
|
|
|
) }
|
|
|
|
|
|
|
|
it { should contain_file('/var/log/nova').with(
|
|
|
|
'ensure' => 'directory',
|
|
|
|
'mode' => '0751',
|
|
|
|
'owner' => 'nova',
|
|
|
|
'group' => 'nova',
|
2012-03-16 17:45:06 +01:00
|
|
|
'require' => 'Package[nova-common]'
|
2012-03-30 23:36:52 -07:00
|
|
|
)}
|
2012-03-16 17:45:06 +01:00
|
|
|
|
2012-03-30 23:36:52 -07:00
|
|
|
it { should contain_file('/etc/nova/nova.conf').with(
|
|
|
|
'mode' => '0640',
|
|
|
|
'owner' => 'nova',
|
|
|
|
'group' => 'nova',
|
2012-03-16 17:45:06 +01:00
|
|
|
'require' => 'Package[nova-common]'
|
2012-03-30 01:09:50 -07:00
|
|
|
)}
|
2012-03-30 23:36:52 -07:00
|
|
|
|
|
|
|
it { should contain_exec('networking-refresh').with(
|
|
|
|
'command' => '/sbin/ifdown -a ; /sbin/ifup -a',
|
|
|
|
'refreshonly' => true
|
|
|
|
)}
|
|
|
|
|
|
|
|
it { should_not contain_nova_config('sql_connection') }
|
|
|
|
|
2012-05-09 16:54:09 -07:00
|
|
|
it { should contain_nova_config('image_service').with_value('nova.image.glance.GlanceImageService') }
|
|
|
|
it { should contain_nova_config('glance_api_servers').with_value('localhost:9292') }
|
|
|
|
|
|
|
|
it { should contain_nova_config('auth_strategy').with_value('keystone') }
|
2012-10-14 01:52:16 -07:00
|
|
|
it { should_not contain_nova_config('use_deprecated_auth').with_value('false') }
|
2012-05-09 16:54:09 -07:00
|
|
|
|
2013-04-05 10:54:34 -04:00
|
|
|
it { should contain_nova_config('rpc_backend').with_value('nova.openstack.common.rpc.impl_kombu') }
|
2012-03-30 23:36:52 -07:00
|
|
|
it { should contain_nova_config('rabbit_host').with_value('localhost') }
|
|
|
|
it { should contain_nova_config('rabbit_password').with_value('guest') }
|
|
|
|
it { should contain_nova_config('rabbit_port').with_value('5672') }
|
2013-04-03 10:34:03 +02:00
|
|
|
it { should contain_nova_config('rabbit_hosts').with_value('localhost:5672') }
|
|
|
|
it { should contain_nova_config('rabbit_ha_queues').with_value('false') }
|
2012-03-30 23:36:52 -07:00
|
|
|
it { should contain_nova_config('rabbit_userid').with_value('guest') }
|
|
|
|
it { should contain_nova_config('rabbit_virtual_host').with_value('/') }
|
2012-05-09 16:54:09 -07:00
|
|
|
|
|
|
|
it { should contain_nova_config('verbose').with_value(false) }
|
|
|
|
it { should contain_nova_config('logdir').with_value('/var/log/nova') }
|
2012-03-30 23:36:52 -07:00
|
|
|
it { should contain_nova_config('state_path').with_value('/var/lib/nova') }
|
|
|
|
it { should contain_nova_config('lock_path').with_value('/var/lock/nova') }
|
|
|
|
it { should contain_nova_config('service_down_time').with_value('60') }
|
2012-10-31 09:10:49 -04:00
|
|
|
it { should contain_nova_config('rootwrap_config').with_value('/etc/nova/rootwrap.conf') }
|
2012-11-16 04:54:53 -08:00
|
|
|
|
2012-03-30 23:36:52 -07:00
|
|
|
|
|
|
|
describe 'with parameters supplied' do
|
|
|
|
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
'sql_connection' => 'mysql://user:pass@db/db',
|
|
|
|
'verbose' => true,
|
|
|
|
'logdir' => '/var/log/nova2',
|
2012-05-09 16:54:09 -07:00
|
|
|
'image_service' => 'nova.image.local.LocalImageService',
|
2012-03-30 23:36:52 -07:00
|
|
|
'rabbit_host' => 'rabbit',
|
2012-05-09 16:54:09 -07:00
|
|
|
'rabbit_userid' => 'rabbit_user',
|
|
|
|
'rabbit_port' => '5673',
|
2012-03-30 23:36:52 -07:00
|
|
|
'rabbit_password' => 'password',
|
|
|
|
'lock_path' => '/var/locky/path',
|
|
|
|
'state_path' => '/var/lib/nova2',
|
|
|
|
'service_down_time' => '120',
|
2012-11-20 19:37:52 +04:00
|
|
|
'auth_strategy' => 'foo',
|
|
|
|
'ensure_package' => '2012.1.1-15.el6'
|
2012-03-30 23:36:52 -07:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2012-11-20 19:37:52 +04:00
|
|
|
it { should contain_package('nova-common').with('ensure' => '2012.1.1-15.el6') }
|
|
|
|
it { should contain_package('python-nova').with('ensure' => '2012.1.1-15.el6') }
|
2012-03-30 23:36:52 -07:00
|
|
|
it { should contain_nova_config('sql_connection').with_value('mysql://user:pass@db/db') }
|
|
|
|
|
2012-05-09 16:54:09 -07:00
|
|
|
it { should contain_nova_config('image_service').with_value('nova.image.local.LocalImageService') }
|
|
|
|
it { should_not contain_nova_config('glance_api_servers') }
|
|
|
|
|
|
|
|
it { should contain_nova_config('auth_strategy').with_value('foo') }
|
2012-10-14 01:52:16 -07:00
|
|
|
it { should_not contain_nova_config('use_deprecated_auth').with_value(true) }
|
2013-04-05 10:54:34 -04:00
|
|
|
it { should contain_nova_config('rpc_backend').with_value('nova.openstack.common.rpc.impl_kombu') }
|
2012-03-30 23:36:52 -07:00
|
|
|
it { should contain_nova_config('rabbit_host').with_value('rabbit') }
|
|
|
|
it { should contain_nova_config('rabbit_password').with_value('password') }
|
2012-05-09 16:54:09 -07:00
|
|
|
it { should contain_nova_config('rabbit_port').with_value('5673') }
|
2012-03-30 23:36:52 -07:00
|
|
|
it { should contain_nova_config('rabbit_userid').with_value('rabbit_user') }
|
|
|
|
it { should contain_nova_config('rabbit_virtual_host').with_value('/') }
|
2013-04-03 10:34:03 +02:00
|
|
|
it { should contain_nova_config('rabbit_hosts').with_value('rabbit:5673') }
|
|
|
|
it { should contain_nova_config('rabbit_ha_queues').with_value('false') }
|
2012-10-14 01:52:16 -07:00
|
|
|
|
2012-05-09 16:54:09 -07:00
|
|
|
it { should contain_nova_config('verbose').with_value(true) }
|
|
|
|
it { should contain_nova_config('logdir').with_value('/var/log/nova2') }
|
2012-03-30 23:36:52 -07:00
|
|
|
it { should contain_nova_config('state_path').with_value('/var/lib/nova2') }
|
|
|
|
it { should contain_nova_config('lock_path').with_value('/var/locky/path') }
|
|
|
|
it { should contain_nova_config('service_down_time').with_value('120') }
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2013-04-03 10:34:03 +02:00
|
|
|
describe 'with some others parameters supplied' do
|
|
|
|
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
'rabbit_hosts' => ['rabbit:5673', 'rabbit2:5674'],
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
it { should_not contain_nova_config('rabbit_host') }
|
|
|
|
it { should_not contain_nova_config('rabbit_port') }
|
|
|
|
it { should contain_nova_config('rabbit_hosts').with_value('rabbit:5673,rabbit2:5674') }
|
|
|
|
it { should contain_nova_config('rabbit_ha_queues').with_value('true') }
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2013-04-05 10:54:34 -04:00
|
|
|
|
|
|
|
describe 'with qpid rpc supplied' do
|
|
|
|
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
'sql_connection' => 'mysql://user:pass@db/db',
|
|
|
|
'verbose' => true,
|
|
|
|
'logdir' => '/var/log/nova2',
|
|
|
|
'image_service' => 'nova.image.local.LocalImageService',
|
|
|
|
'rpc_backend' => 'nova.openstack.common.rpc.impl_qpid',
|
|
|
|
'lock_path' => '/var/locky/path',
|
|
|
|
'state_path' => '/var/lib/nova2',
|
|
|
|
'service_down_time' => '120',
|
|
|
|
'auth_strategy' => 'foo',
|
|
|
|
'ensure_package' => '2012.1.1-15.el6'
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
it { should contain_package('nova-common').with('ensure' => '2012.1.1-15.el6') }
|
|
|
|
it { should contain_package('python-nova').with('ensure' => '2012.1.1-15.el6') }
|
|
|
|
it { should contain_nova_config('sql_connection').with_value('mysql://user:pass@db/db') }
|
|
|
|
|
|
|
|
it { should contain_nova_config('image_service').with_value('nova.image.local.LocalImageService') }
|
|
|
|
it { should_not contain_nova_config('glance_api_servers') }
|
|
|
|
|
|
|
|
it { should contain_nova_config('auth_strategy').with_value('foo') }
|
|
|
|
it { should_not contain_nova_config('use_deprecated_auth').with_value(true) }
|
|
|
|
it { should contain_nova_config('rpc_backend').with_value('nova.openstack.common.rpc.impl_qpid') }
|
|
|
|
it { should contain_nova_config('qpid_hostname').with_value('localhost') }
|
|
|
|
it { should contain_nova_config('qpid_port').with_value('5672') }
|
|
|
|
it { should contain_nova_config('qpid_username').with_value('guest') }
|
|
|
|
it { should contain_nova_config('qpid_password').with_value('guest') }
|
|
|
|
it { should contain_nova_config('qpid_reconnect').with_value('true') }
|
|
|
|
it { should contain_nova_config('qpid_reconnect_timeout').with_value('0') }
|
|
|
|
it { should contain_nova_config('qpid_reconnect_limit').with_value('0') }
|
|
|
|
it { should contain_nova_config('qpid_reconnect_interval_min').with_value('0') }
|
|
|
|
it { should contain_nova_config('qpid_reconnect_interval_max').with_value('0') }
|
|
|
|
it { should contain_nova_config('qpid_reconnect_interval').with_value('0') }
|
|
|
|
it { should contain_nova_config('qpid_heartbeat').with_value('60') }
|
|
|
|
it { should contain_nova_config('qpid_protocol').with_value('tcp') }
|
|
|
|
it { should contain_nova_config('qpid_tcp_nodelay').with_value('true') }
|
|
|
|
|
|
|
|
it { should contain_nova_config('verbose').with_value(true) }
|
|
|
|
it { should contain_nova_config('logdir').with_value('/var/log/nova2') }
|
|
|
|
it { should contain_nova_config('state_path').with_value('/var/lib/nova2') }
|
|
|
|
it { should contain_nova_config('lock_path').with_value('/var/locky/path') }
|
|
|
|
it { should contain_nova_config('service_down_time').with_value('120') }
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2012-03-30 23:36:52 -07:00
|
|
|
describe "When platform is RedHat" do
|
|
|
|
let :facts do
|
|
|
|
{:osfamily => 'RedHat'}
|
|
|
|
end
|
|
|
|
it { should contain_package('nova-common').with(
|
2012-11-02 11:12:39 -07:00
|
|
|
'name' => 'openstack-nova-common',
|
2012-03-30 23:36:52 -07:00
|
|
|
'ensure' => 'present'
|
|
|
|
)}
|
2012-10-31 09:10:49 -04:00
|
|
|
it { should contain_nova_config('rootwrap_config').with_value('/etc/nova/rootwrap.conf') }
|
2012-03-30 23:36:52 -07:00
|
|
|
end
|
2012-03-30 01:09:50 -07:00
|
|
|
end
|
2012-03-16 17:45:06 +01:00
|
|
|
end
|