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::ceph class
23 describe 'cinder::backup::ceph' do
25 let :default_params do
26 { :backup_ceph_conf => '/etc/ceph/ceph.conf',
27 :backup_ceph_user => 'cinder',
28 :backup_ceph_chunk_size => '134217728',
29 :backup_ceph_pool => 'backups',
30 :backup_ceph_stripe_unit => '0',
31 :backup_ceph_stripe_count => '0' }
38 shared_examples_for 'cinder backup with ceph' do
40 default_params.merge(params)
43 it 'configures cinder.conf' do
44 should contain_cinder_config('DEFAULT/backup_driver').with_value('cinder.backup.drivers.ceph')
45 should contain_cinder_config('DEFAULT/backup_ceph_conf').with_value(p[:backup_ceph_conf])
46 should contain_cinder_config('DEFAULT/backup_ceph_user').with_value(p[:backup_ceph_user])
47 should contain_cinder_config('DEFAULT/backup_ceph_chunk_size').with_value(p[:backup_ceph_chunk_size])
48 should contain_cinder_config('DEFAULT/backup_ceph_pool').with_value(p[:backup_ceph_pool])
49 should contain_cinder_config('DEFAULT/backup_ceph_stripe_unit').with_value(p[:backup_ceph_stripe_unit])
50 should contain_cinder_config('DEFAULT/backup_ceph_stripe_count').with_value(p[:backup_ceph_stripe_count])
53 context 'when overriding default parameters' do
55 params.merge!(:backup_ceph_conf => '/tmp/ceph.conf')
56 params.merge!(:backup_ceph_user => 'toto')
57 params.merge!(:backup_ceph_chunk_size => '123')
58 params.merge!(:backup_ceph_pool => 'foo')
59 params.merge!(:backup_ceph_stripe_unit => '56')
60 params.merge!(:backup_ceph_stripe_count => '67')
62 it 'should replace default parameters with new values' do
63 should contain_cinder_config('DEFAULT/backup_ceph_conf').with_value(p[:backup_ceph_conf])
64 should contain_cinder_config('DEFAULT/backup_ceph_user').with_value(p[:backup_ceph_user])
65 should contain_cinder_config('DEFAULT/backup_ceph_chunk_size').with_value(p[:backup_ceph_chunk_size])
66 should contain_cinder_config('DEFAULT/backup_ceph_pool').with_value(p[:backup_ceph_pool])
67 should contain_cinder_config('DEFAULT/backup_ceph_stripe_unit').with_value(p[:backup_ceph_stripe_unit])
68 should contain_cinder_config('DEFAULT/backup_ceph_stripe_count').with_value(p[:backup_ceph_stripe_count])
73 context 'on Debian platforms' do
75 { :osfamily => 'Debian' }
78 it_configures 'cinder backup with ceph'
81 context 'on RedHat platforms' do
83 { :osfamily => 'RedHat' }
86 it_configures 'cinder backup with ceph'