try again, with puppetforge modules, correctly included now
[mirror/dsa-puppet.git] / 3rdparty / modules / cinder / spec / classes / cinder_glance_spec.rb
1 #
2 # Copyright (C) 2013 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::glance class
19 #
20
21 require 'spec_helper'
22
23 describe 'cinder::glance' do
24
25   let :default_params do
26     { :glance_api_version         => '2',
27       :glance_num_retries         => '0',
28       :glance_api_insecure        => false,
29       :glance_api_ssl_compression => false }
30   end
31
32   let :params do
33     {}
34   end
35
36   shared_examples_for 'cinder with glance' do
37     let :p do
38       default_params.merge(params)
39     end
40
41     it 'configures cinder.conf with default params' do
42       should contain_cinder_config('DEFAULT/glance_api_version').with_value(p[:glance_api_version])
43       should contain_cinder_config('DEFAULT/glance_num_retries').with_value(p[:glance_num_retries])
44       should contain_cinder_config('DEFAULT/glance_api_insecure').with_value(p[:glance_api_insecure])
45     end
46
47      context 'configure cinder with one glance server' do
48        before :each do
49         params.merge!(:glance_api_servers => '10.0.0.1:9292')
50        end
51        it 'should configure one glance server' do
52          should contain_cinder_config('DEFAULT/glance_api_servers').with_value(p[:glance_api_servers])
53        end
54      end
55
56      context 'configure cinder with two glance servers' do
57        before :each do
58         params.merge!(:glance_api_servers => ['10.0.0.1:9292','10.0.0.2:9292'])
59        end
60        it 'should configure two glance servers' do
61          should contain_cinder_config('DEFAULT/glance_api_servers').with_value(p[:glance_api_servers].join(','))
62        end
63      end
64   end
65
66   context 'on Debian platforms' do
67     let :facts do
68       { :osfamily => 'Debian' }
69     end
70
71     it_configures 'cinder with glance'
72   end
73
74   context 'on RedHat platforms' do
75     let :facts do
76       { :osfamily => 'RedHat' }
77     end
78
79     it_configures 'cinder with glance'
80   end
81
82 end