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::backup::swift class
23 describe 'cinder::backup::swift' do
25 let :default_params do
26 { :backup_swift_url => 'http://localhost:8080/v1/AUTH_',
27 :backup_swift_container => 'volumes_backup',
28 :backup_swift_object_size => '52428800',
29 :backup_swift_retry_attempts => '3',
30 :backup_swift_retry_backoff => '2' }
37 shared_examples_for 'cinder backup with swift' do
39 default_params.merge(params)
42 it 'configures cinder.conf' do
43 should contain_cinder_config('DEFAULT/backup_driver').with_value('cinder.backup.drivers.swift')
44 should contain_cinder_config('DEFAULT/backup_swift_url').with_value(p[:backup_swift_url])
45 should contain_cinder_config('DEFAULT/backup_swift_container').with_value(p[:backup_swift_container])
46 should contain_cinder_config('DEFAULT/backup_swift_object_size').with_value(p[:backup_swift_object_size])
47 should contain_cinder_config('DEFAULT/backup_swift_retry_attempts').with_value(p[:backup_swift_retry_attempts])
48 should contain_cinder_config('DEFAULT/backup_swift_retry_backoff').with_value(p[:backup_swift_retry_backoff])
51 context 'when overriding default parameters' do
53 params.merge!(:backup_swift_url => 'https://controller2:8080/v1/AUTH_')
54 params.merge!(:backup_swift_container => 'toto')
55 params.merge!(:backup_swift_object_size => '123')
56 params.merge!(:backup_swift_retry_attempts => '99')
57 params.merge!(:backup_swift_retry_backoff => '56')
59 it 'should replace default parameters with new values' do
60 should contain_cinder_config('DEFAULT/backup_swift_url').with_value(p[:backup_swift_url])
61 should contain_cinder_config('DEFAULT/backup_swift_container').with_value(p[:backup_swift_container])
62 should contain_cinder_config('DEFAULT/backup_swift_object_size').with_value(p[:backup_swift_object_size])
63 should contain_cinder_config('DEFAULT/backup_swift_retry_attempts').with_value(p[:backup_swift_retry_attempts])
64 should contain_cinder_config('DEFAULT/backup_swift_retry_backoff').with_value(p[:backup_swift_retry_backoff])
69 context 'on Debian platforms' do
71 { :osfamily => 'Debian' }
74 it_configures 'cinder backup with swift'
77 context 'on RedHat platforms' do
79 { :osfamily => 'RedHat' }
82 it_configures 'cinder backup with swift'