try again, with puppetforge modules, correctly included now
[mirror/dsa-puppet.git] / 3rdparty / modules / cinder / spec / classes / cinder_backends_spec.rb
1 #
2 # Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
3 #
4 # Author: Emilien Macchi <emilien.macchi@enovance.com>
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License"); you may
7 # not use this file except in compliance with the License. You may obtain
8 # a copy of the License at
9 #
10 #      http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 # License for the specific language governing permissions and limitations
16 # under the License.
17 #
18 # Unit tests for cinder::backends class
19 #
20
21 require 'spec_helper'
22
23 describe 'cinder::backends' do
24
25   let :default_params do
26     {}
27   end
28
29   let :params do
30     {}
31   end
32
33   shared_examples_for 'cinder backends' do
34
35     let :p do
36       default_params.merge(params)
37     end
38
39     context 'configure cinder with default parameters' do
40       before :each do
41         params.merge!(
42          :enabled_backends => ['lowcost', 'regular', 'premium'],
43          :default_volume_type => false
44         )
45       end
46
47       it 'configures cinder.conf with default params' do
48         should contain_cinder_config('DEFAULT/enabled_backends').with_value(p[:enabled_backends].join(','))
49       end
50     end
51
52     context 'configure cinder with a default volume type' do
53       before :each do
54         params.merge!(
55          :enabled_backends    => ['foo', 'bar'],
56          :default_volume_type => 'regular'
57         )
58       end
59
60       it 'should fail to configure default volume type' do
61         expect { subject }.to raise_error(Puppet::Error, /The default_volume_type parameter is deprecated in this class, you should declare it in cinder::api./)
62       end
63     end
64
65   end
66
67   context 'on Debian platforms' do
68     let :facts do
69       { :osfamily => 'Debian' }
70     end
71
72     it_configures 'cinder backends'
73   end
74
75   context 'on RedHat platforms' do
76     let :facts do
77       { :osfamily => 'RedHat' }
78     end
79
80     it_configures 'cinder backends'
81   end
82
83 end