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 cinder::glance class
23 describe 'cinder::glance' do
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 }
36 shared_examples_for 'cinder with glance' do
38 default_params.merge(params)
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])
47 context 'configure cinder with one glance server' do
49 params.merge!(:glance_api_servers => '10.0.0.1:9292')
51 it 'should configure one glance server' do
52 should contain_cinder_config('DEFAULT/glance_api_servers').with_value(p[:glance_api_servers])
56 context 'configure cinder with two glance servers' do
58 params.merge!(:glance_api_servers => ['10.0.0.1:9292','10.0.0.2:9292'])
60 it 'should configure two glance servers' do
61 should contain_cinder_config('DEFAULT/glance_api_servers').with_value(p[:glance_api_servers].join(','))
66 context 'on Debian platforms' do
68 { :osfamily => 'Debian' }
71 it_configures 'cinder with glance'
74 context 'on RedHat platforms' do
76 { :osfamily => 'RedHat' }
79 it_configures 'cinder with glance'