2 # Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
4 # Author: Emilien Macchi <emilien.macchi@enovance.com>
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
10 # http://www.apache.org/licenses/LICENSE-2.0
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
18 # Unit tests for glance::backend::cinder class
23 describe 'glance::backend::cinder' do
26 'class { "glance::api": keystone_password => "pass" }'
29 shared_examples_for 'glance with cinder backend' do
31 context 'when default parameters' do
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')
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')
50 context 'when overriding parameters' do
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',
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')
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')
79 context 'on Debian platforms' do
81 { :osfamily => 'Debian' }
84 it_configures 'glance with cinder backend'
87 context 'on RedHat platforms' do
89 { :osfamily => 'RedHat' }
92 it_configures 'glance with cinder backend'