]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/glance/spec/classes/glance_backend_cinder_spec.rb
try again, with puppetforge modules, correctly included now
[dsa-puppet.git] / 3rdparty / modules / glance / spec / classes / glance_backend_cinder_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 glance::backend::cinder class
19 #
20
21 require 'spec_helper'
22
23 describe 'glance::backend::cinder' do
24
25   let :pre_condition do
26     'class { "glance::api": keystone_password => "pass" }'
27   end
28
29   shared_examples_for 'glance with cinder backend' do
30
31     context 'when default parameters' do
32
33       it 'configures glance-api.conf' do
34         should contain_glance_api_config('glance_store/default_store').with_value('cinder')
35         should contain_glance_api_config('DEFAULT/cinder_api_insecure').with_value(false)
36         should contain_glance_api_config('DEFAULT/cinder_catalog_info').with_value('volume:cinder:publicURL')
37         should contain_glance_api_config('DEFAULT/cinder_http_retries').with_value('3')
38         should contain_glance_api_config('DEFAULT/cinder_ca_certificates_file').with(:ensure => 'absent')
39         should contain_glance_api_config('DEFAULT/cinder_endpoint_template').with(:ensure => 'absent')
40       end
41       it 'configures glance-cache.conf' do
42         should contain_glance_cache_config('DEFAULT/cinder_api_insecure').with_value(false)
43         should contain_glance_cache_config('DEFAULT/cinder_catalog_info').with_value('volume:cinder:publicURL')
44         should contain_glance_cache_config('DEFAULT/cinder_http_retries').with_value('3')
45         should contain_glance_cache_config('DEFAULT/cinder_ca_certificates_file').with(:ensure => 'absent')
46         should contain_glance_cache_config('DEFAULT/cinder_endpoint_template').with(:ensure => 'absent')
47       end
48     end
49
50     context 'when overriding parameters' do
51       let :params do
52         {
53           :cinder_api_insecure         => true,
54           :cinder_ca_certificates_file => '/etc/ssh/ca.crt',
55           :cinder_catalog_info         => 'volume:cinder:internalURL',
56           :cinder_endpoint_template    => 'http://srv-foo:8776/v1/%(project_id)s',
57           :cinder_http_retries         => '10',
58         }
59       end
60       it 'configures glance-api.conf' do
61         should contain_glance_api_config('glance_store/default_store').with_value('cinder')
62         should contain_glance_api_config('DEFAULT/cinder_api_insecure').with_value(true)
63         should contain_glance_api_config('DEFAULT/cinder_ca_certificates_file').with_value('/etc/ssh/ca.crt')
64         should contain_glance_api_config('DEFAULT/cinder_catalog_info').with_value('volume:cinder:internalURL')
65         should contain_glance_api_config('DEFAULT/cinder_endpoint_template').with_value('http://srv-foo:8776/v1/%(project_id)s')
66         should contain_glance_api_config('DEFAULT/cinder_http_retries').with_value('10')
67       end
68       it 'configures glance-cache.conf' do
69         should contain_glance_cache_config('DEFAULT/cinder_api_insecure').with_value(true)
70         should contain_glance_cache_config('DEFAULT/cinder_ca_certificates_file').with_value('/etc/ssh/ca.crt')
71         should contain_glance_cache_config('DEFAULT/cinder_catalog_info').with_value('volume:cinder:internalURL')
72         should contain_glance_cache_config('DEFAULT/cinder_endpoint_template').with_value('http://srv-foo:8776/v1/%(project_id)s')
73         should contain_glance_cache_config('DEFAULT/cinder_http_retries').with_value('10')
74       end
75     end
76
77   end
78
79   context 'on Debian platforms' do
80     let :facts do
81       { :osfamily => 'Debian' }
82     end
83
84     it_configures 'glance with cinder backend'
85   end
86
87   context 'on RedHat platforms' do
88     let :facts do
89       { :osfamily => 'RedHat' }
90     end
91
92     it_configures 'glance with cinder backend'
93   end
94 end