2 # Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
4 # Author: Emilien Macchi <emilien.macchi@enovance.com>
5 # François Charlier <francois.charlier@enovance.com>
7 # Licensed under the Apache License, Version 2.0 (the "License"); you may
8 # not use this file except in compliance with the License. You may obtain
9 # a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16 # License for the specific language governing permissions and limitations
19 # Unit tests for nova::cells class
24 describe 'nova::cells' do
30 let :default_params do
32 :bandwidth_update_interval => '600',
33 :call_timeout => '60',
34 :capabilities => ['hypervisor=xenserver;kvm','os=linux;windows'],
35 :db_check_interval => '60',
36 :driver => 'nova.cells.rpc_driver.CellsRPCDriver',
37 :instance_updated_at_threshold => '3600',
38 :instance_update_num_instances => '1',
39 :manager => 'nova.cells.manager.CellsManager',
40 :max_hop_count => '10',
41 :mute_child_interval => '300',
42 :mute_weight_multiplier => '-10.0',
43 :mute_weight_value => '1000.0',
44 :ram_weight_multiplier => '10.0',
45 :reserve_percent => '10.0',
46 :rpc_driver_queue_base => 'cells.intercell',
47 :scheduler_filter_classes => 'nova.cells.filters.all_filters',
48 :scheduler => 'nova.cells.scheduler.CellsScheduler',
49 :scheduler_retries => '10',
50 :scheduler_retry_delay => '2',
51 :scheduler_weight_classes => 'nova.cells.weights.all_weighers',
52 :weight_offset => '1.0',
53 :weight_scale => '1.0'}
56 shared_examples_for 'nova-cells' do
58 it { should contain_class('nova::params') }
60 it 'installs nova-cells package' do
61 should contain_package('nova-cells').with(
63 :name => platform_params[:cells_package_name],
64 :tag => ['openstack', 'nova']
68 it 'configures nova-cells service' do
69 should contain_service('nova-cells').with(
71 :name => platform_params[:cells_service_name]
75 it 'configures cell' do
76 should contain_nova_config('cells/bandwidth_update_interval').with(:value => '600')
77 should contain_nova_config('cells/call_timeout').with(:value => '60')
78 should contain_nova_config('cells/capabilities').with(:value => 'hypervisor=xenserver;kvm,os=linux;windows')
79 should contain_nova_config('cells/db_check_interval').with(:value => '60')
80 should contain_nova_config('cells/driver').with(:value => 'nova.cells.rpc_driver.CellsRPCDriver')
81 should contain_nova_config('cells/instance_updated_at_threshold').with(:value => '3600')
82 should contain_nova_config('cells/instance_update_num_instances').with(:value => '1')
83 should contain_nova_config('cells/manager').with(:value => 'nova.cells.manager.CellsManager')
84 should contain_nova_config('cells/max_hop_count').with(:value => '10')
85 should contain_nova_config('cells/mute_child_interval').with(:value => '300')
86 should contain_nova_config('cells/mute_weight_multiplier').with(:value => '-10.0')
87 should contain_nova_config('cells/mute_weight_value').with(:value => '1000.0')
88 should contain_nova_config('cells/ram_weight_multiplier').with(:value => '10.0')
89 should contain_nova_config('cells/reserve_percent').with(:value => '10.0')
90 should contain_nova_config('cells/rpc_driver_queue_base').with(:value => 'cells.intercell')
91 should contain_nova_config('cells/scheduler_filter_classes').with(:value => 'nova.cells.filters.all_filters')
92 should contain_nova_config('cells/scheduler_retries').with(:value => '10')
93 should contain_nova_config('cells/scheduler_retry_delay').with(:value => '2')
94 should contain_nova_config('cells/scheduler_weight_classes').with(:value => 'nova.cells.weights.all_weighers')
95 should contain_nova_config('cells/scheduler').with(:value => 'nova.cells.scheduler.CellsScheduler')
99 shared_examples_for 'a parent cell' do
102 :cell_type => 'parent',
103 :cell_name => 'mommy' }
105 let :expected_params do
106 default_params.merge(params)
108 it { should contain_nova_config('cells/name').with_value(expected_params[:cell_name]) }
109 it { should contain_nova_config('DEFAULT/compute_api_class').with_value('nova.compute.cells_api.ComputeCellsAPI')}
110 it { should contain_nova_config('cells/cell_type').with_value('api')}
111 it_configures 'nova-cells'
114 shared_examples_for 'a parent cell with manage_service as false' do
117 :manage_service => false,
118 :cell_type => 'parent',
119 :cell_name => 'mommy' }
121 let :expected_params do
122 default_params.merge(params)
124 it { should contain_service(platform_params[:cells_service_name]).without_ensure }
127 shared_examples_for 'a child cell' do
130 :cell_type => 'child',
131 :cell_name => 'henry' }
133 let :expected_params do
134 default_params.merge(params)
136 it { should contain_nova_config('cells/name').with_value(expected_params[:cell_name]) }
137 it { should contain_nova_config('DEFAULT/quota_driver').with_value('nova.quota.NoopQuotaDriver')}
138 it { should contain_nova_config('cells/cell_type').with_value('compute')}
139 it_configures 'nova-cells'
143 context 'on Debian platforms' do
145 { :osfamily => 'Debian' }
148 let :platform_params do
150 :cells_package_name => 'nova-cells',
151 :cells_service_name => 'nova-cells'
155 it_configures 'a parent cell'
156 it_configures 'a parent cell with manage_service as false'
157 it_configures 'a child cell'
160 context 'on RedHat platforms' do
162 { :osfamily => 'RedHat' }
165 let :platform_params do
167 :cells_package_name => 'openstack-nova-cells',
168 :cells_service_name => 'openstack-nova-cells'
172 it_configures 'a parent cell'
173 it_configures 'a child cell'