950d0c41121c7d90f4d0da60de3d5a388d59eb9a
[mirror/dsa-puppet.git] / 3rdparty / modules / cinder / spec / classes / cinder_volume_glusterfs_spec.rb
1 require 'spec_helper'
2
3 describe 'cinder::volume::glusterfs' do
4
5   shared_examples_for 'glusterfs volume driver' do
6     let :params do
7       {
8         :glusterfs_shares           => ['10.10.10.10:/volumes', '10.10.10.11:/volumes'],
9         :glusterfs_shares_config    => '/etc/cinder/other_shares.conf',
10         :glusterfs_sparsed_volumes  => true,
11         :glusterfs_mount_point_base => '/cinder_mount_point',
12       }
13     end
14
15     it 'configures glusterfs volume driver' do
16       should contain_cinder_config('DEFAULT/volume_driver').with_value(
17         'cinder.volume.drivers.glusterfs.GlusterfsDriver')
18       should contain_cinder_config('DEFAULT/glusterfs_shares_config').with_value(
19         '/etc/cinder/other_shares.conf')
20       should contain_cinder_config('DEFAULT/glusterfs_sparsed_volumes').with_value(
21         true)
22       should contain_cinder_config('DEFAULT/glusterfs_mount_point_base').with_value(
23         '/cinder_mount_point')
24       should contain_file('/etc/cinder/other_shares.conf').with(
25         :content => "10.10.10.10:/volumes\n10.10.10.11:/volumes\n",
26         :require => 'Package[cinder]',
27         :notify  => 'Service[cinder-volume]'
28       )
29     end
30
31     context "with an parameter which has been removed" do
32       before do
33         params.merge!({
34           :glusterfs_disk_util => 'foo',
35         })
36       end
37       it 'should fails' do
38         expect { subject }.to raise_error(Puppet::Error, /glusterfs_disk_util is removed in Icehouse./)
39       end
40     end
41   end
42
43   context 'on Debian platforms' do
44     let :facts do
45       { :osfamily => 'Debian' }
46     end
47
48     it_configures 'glusterfs volume driver'
49   end
50
51   context 'on RedHat platforms' do
52     let :facts do
53       { :osfamily => 'RedHat' }
54     end
55
56     it_configures 'glusterfs volume driver'
57   end
58
59 end