| 1 |
require 'spec_helper' |
| 2 |
|
| 3 |
describe 'nova::conductor' do |
| 4 |
|
| 5 |
let :pre_condition do |
| 6 |
'include nova' |
| 7 |
end |
| 8 |
|
| 9 |
shared_examples 'nova-conductor' do |
| 10 |
|
| 11 |
|
| 12 |
it { is_expected.to contain_package('nova-conductor').with( |
| 13 |
:name => platform_params[:conductor_package_name], |
| 14 |
:ensure => 'present' |
| 15 |
) } |
| 16 |
|
| 17 |
it { is_expected.to contain_service('nova-conductor').with( |
| 18 |
:name => platform_params[:conductor_service_name], |
| 19 |
:hasstatus => 'true', |
| 20 |
:ensure => 'running' |
| 21 |
)} |
| 22 |
|
| 23 |
it { is_expected.to contain_class('nova::availability_zone') } |
| 24 |
|
| 25 |
context 'with manage_service as false' do |
| 26 |
let :params do |
| 27 |
{ |
| 28 |
:manage_service => false |
| 29 |
} |
| 30 |
end |
| 31 |
it { is_expected.to_not contain_service('nova-conductor') } |
| 32 |
end |
| 33 |
|
| 34 |
context 'with package version' do |
| 35 |
let :params do |
| 36 |
{ :ensure_package => '2012.1-2' } |
| 37 |
end |
| 38 |
|
| 39 |
it { is_expected.to contain_package('nova-conductor').with( |
| 40 |
:ensure => params[:ensure_package] |
| 41 |
)} |
| 42 |
end |
| 43 |
|
| 44 |
context 'with default workers parameter' do |
| 45 |
it { is_expected.to contain_nova_config('conductor/workers').with_value(2) } |
| 46 |
end |
| 47 |
|
| 48 |
context 'with overridden workers parameter' do |
| 49 |
let :params do |
| 50 |
{:workers => 5 } |
| 51 |
end |
| 52 |
it { is_expected.to contain_nova_config('conductor/workers').with_value(5) } |
| 53 |
end |
| 54 |
|
| 55 |
context 'with default enable_new_services parameter' do |
| 56 |
it { is_expected.to contain_nova_config('DEFAULT/enable_new_services').with_value('<SERVICE DEFAULT>') } |
| 57 |
end |
| 58 |
|
| 59 |
context 'with enable_new_services parameter set to false' do |
| 60 |
let :params do |
| 61 |
{ :enable_new_services => false } |
| 62 |
end |
| 63 |
|
| 64 |
it { is_expected.to contain_nova_config('DEFAULT/enable_new_services').with_value(false) } |
| 65 |
end |
| 66 |
|
| 67 |
end |
| 68 |
|
| 69 |
on_supported_os({ |
| 70 |
:supported_os => OSDefaults.get_supported_os |
| 71 |
}).each do |os,facts| |
| 72 |
context "on #{os}" do |
| 73 |
let (:facts) do |
| 74 |
facts.merge!(OSDefaults.get_facts({ :os_workers => 2 })) |
| 75 |
end |
| 76 |
|
| 77 |
let (:platform_params) do |
| 78 |
case facts[:os]['family'] |
| 79 |
when 'Debian' |
| 80 |
{ :conductor_package_name => 'nova-conductor', |
| 81 |
:conductor_service_name => 'nova-conductor' } |
| 82 |
when 'RedHat' |
| 83 |
{ :conductor_package_name => 'openstack-nova-conductor', |
| 84 |
:conductor_service_name => 'openstack-nova-conductor' } |
| 85 |
end |
| 86 |
end |
| 87 |
it_configures 'nova-conductor' |
| 88 |
end |
| 89 |
end |
| 90 |
|
| 91 |
end |