| 1 |
require 'spec_helper' |
| 2 |
|
| 3 |
describe 'nova::scheduler' do |
| 4 |
let :pre_condition do |
| 5 |
'include nova' |
| 6 |
end |
| 7 |
|
| 8 |
shared_examples 'nova::scheduler' do |
| 9 |
it { is_expected.to contain_package('nova-scheduler').with( |
| 10 |
:name => platform_params[:scheduler_package_name], |
| 11 |
:ensure => 'present' |
| 12 |
) } |
| 13 |
|
| 14 |
it { is_expected.to contain_service('nova-scheduler').with( |
| 15 |
:name => platform_params[:scheduler_service_name], |
| 16 |
:hasstatus => 'true', |
| 17 |
:ensure => 'running' |
| 18 |
)} |
| 19 |
|
| 20 |
it { is_expected.to contain_nova_config('scheduler/workers').with_value(4) } |
| 21 |
it { is_expected.to contain_nova_config('scheduler/max_attempts').with_value('<SERVICE DEFAULT>') } |
| 22 |
it { is_expected.to contain_nova_config('scheduler/discover_hosts_in_cells_interval').with_value('<SERVICE DEFAULT>') } |
| 23 |
it { is_expected.to contain_nova_config('scheduler/query_placement_for_image_type_support').with_value('<SERVICE DEFAULT>') } |
| 24 |
it { is_expected.to contain_nova_config('scheduler/limit_tenants_to_placement_aggregate').with_value('<SERVICE DEFAULT>') } |
| 25 |
it { is_expected.to contain_nova_config('scheduler/placement_aggregate_required_for_tenants').with_value('<SERVICE DEFAULT>') } |
| 26 |
it { is_expected.to contain_nova_config('scheduler/max_placement_results').with_value('<SERVICE DEFAULT>') } |
| 27 |
it { is_expected.to contain_nova_config('scheduler/enable_isolated_aggregate_filtering').with_value('<SERVICE DEFAULT>') } |
| 28 |
it { is_expected.to contain_nova_config('scheduler/query_placement_for_routed_network_aggregates').with_value('<SERVICE DEFAULT>') } |
| 29 |
|
| 30 |
it { is_expected.to contain_class('nova::availability_zone') } |
| 31 |
|
| 32 |
context 'with manage_service as false' do |
| 33 |
let :params do |
| 34 |
{ |
| 35 |
:manage_service => false |
| 36 |
} |
| 37 |
end |
| 38 |
it { is_expected.to_not contain_service('nova-scheduler') } |
| 39 |
end |
| 40 |
|
| 41 |
context 'with package version' do |
| 42 |
let :params do |
| 43 |
{ :ensure_package => '2012.1-2' } |
| 44 |
end |
| 45 |
|
| 46 |
it { is_expected.to contain_package('nova-scheduler').with( |
| 47 |
:ensure => params[:ensure_package] |
| 48 |
)} |
| 49 |
end |
| 50 |
|
| 51 |
context 'with workers' do |
| 52 |
let :params do |
| 53 |
{ :workers => 8 } |
| 54 |
end |
| 55 |
|
| 56 |
it { is_expected.to contain_nova_config('scheduler/workers').with_value(8) } |
| 57 |
end |
| 58 |
|
| 59 |
context 'with max_attempts' do |
| 60 |
let :params do |
| 61 |
{ :max_attempts => 10 } |
| 62 |
end |
| 63 |
|
| 64 |
it { is_expected.to contain_nova_config('scheduler/max_attempts').with_value(10) } |
| 65 |
end |
| 66 |
|
| 67 |
context 'with discover_hosts_in_cells_interval' do |
| 68 |
let :params do |
| 69 |
{ :discover_hosts_in_cells_interval => 15 } |
| 70 |
end |
| 71 |
|
| 72 |
it { is_expected.to contain_nova_config('scheduler/discover_hosts_in_cells_interval').with_value(15) } |
| 73 |
end |
| 74 |
|
| 75 |
context 'with query_placement_for_image_type_support' do |
| 76 |
let :params do |
| 77 |
{ :query_placement_for_image_type_support => true } |
| 78 |
end |
| 79 |
|
| 80 |
it { is_expected.to contain_nova_config('scheduler/query_placement_for_image_type_support').with_value(true) } |
| 81 |
end |
| 82 |
|
| 83 |
context 'with limit_tenants_to_placement_aggregate' do |
| 84 |
let :params do |
| 85 |
{ :limit_tenants_to_placement_aggregate => true } |
| 86 |
end |
| 87 |
|
| 88 |
it { is_expected.to contain_nova_config('scheduler/limit_tenants_to_placement_aggregate').with_value(true) } |
| 89 |
end |
| 90 |
|
| 91 |
context 'with placement_aggregate_required_for_tenants' do |
| 92 |
let :params do |
| 93 |
{ :placement_aggregate_required_for_tenants => true } |
| 94 |
end |
| 95 |
|
| 96 |
it { is_expected.to contain_nova_config('scheduler/placement_aggregate_required_for_tenants').with_value(true) } |
| 97 |
end |
| 98 |
|
| 99 |
context 'with max_placement_results' do |
| 100 |
let :params do |
| 101 |
{ :max_placement_results => 10 } |
| 102 |
end |
| 103 |
|
| 104 |
it { is_expected.to contain_nova_config('scheduler/max_placement_results').with_value(10) } |
| 105 |
end |
| 106 |
|
| 107 |
context 'with enable_isolated_aggregate_filtering' do |
| 108 |
let :params do |
| 109 |
{ :enable_isolated_aggregate_filtering => true } |
| 110 |
end |
| 111 |
|
| 112 |
it { is_expected.to contain_nova_config('scheduler/enable_isolated_aggregate_filtering').with_value(true) } |
| 113 |
end |
| 114 |
|
| 115 |
context 'with query_placement_for_routed_network_aggregates' do |
| 116 |
let :params do |
| 117 |
{ :query_placement_for_routed_network_aggregates => true } |
| 118 |
end |
| 119 |
|
| 120 |
it { is_expected.to contain_nova_config('scheduler/query_placement_for_routed_network_aggregates').with_value(true) } |
| 121 |
end |
| 122 |
|
| 123 |
end |
| 124 |
|
| 125 |
on_supported_os({ |
| 126 |
:supported_os => OSDefaults.get_supported_os |
| 127 |
}).each do |os,facts| |
| 128 |
context "on #{os}" do |
| 129 |
let (:facts) do |
| 130 |
facts.merge!(OSDefaults.get_facts({ :os_workers => 4 })) |
| 131 |
end |
| 132 |
|
| 133 |
let (:platform_params) do |
| 134 |
case facts[:os]['family'] |
| 135 |
when 'Debian' |
| 136 |
{ :scheduler_package_name => 'nova-scheduler', |
| 137 |
:scheduler_service_name => 'nova-scheduler' } |
| 138 |
when 'RedHat' |
| 139 |
{ :scheduler_package_name => 'openstack-nova-scheduler', |
| 140 |
:scheduler_service_name => 'openstack-nova-scheduler' } |
| 141 |
end |
| 142 |
end |
| 143 |
|
| 144 |
it_behaves_like 'nova::scheduler' |
| 145 |
end |
| 146 |
end |
| 147 |
end |