8aa364c3fd9d2805e9282a68377f42ae39dfe75f
[mirror/dsa-puppet.git] / 3rdparty / modules / cinder / spec / classes / cinder_volume_vmdk_spec.rb
1 require 'spec_helper'
2
3 describe 'cinder::volume::vmdk' do
4
5   let :params do
6     {
7         :host_ip => '172.16.16.16',
8         :host_password => 'asdf',
9         :host_username => 'user'
10     }
11   end
12
13   let :optional_params do
14     {
15         :volume_folder => 'cinder-volume-folder',
16         :api_retry_count => 5,
17         :max_object_retrieval => 200,
18         :task_poll_interval => 10,
19         :image_transfer_timeout_secs => 3600,
20         :wsdl_location => 'http://127.0.0.1:8080/vmware/SDK/wsdl/vim25/vimService.wsdl'
21     }
22   end
23
24   it 'should configure vmdk driver in cinder.conf' do
25     should contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver')
26     should contain_cinder_config('DEFAULT/vmware_host_ip').with_value(params[:host_ip])
27     should contain_cinder_config('DEFAULT/vmware_host_username').with_value(params[:host_username])
28     should contain_cinder_config('DEFAULT/vmware_host_password').with_value(params[:host_password])
29     should contain_cinder_config('DEFAULT/vmware_volume_folder').with_value('cinder-volumes')
30     should contain_cinder_config('DEFAULT/vmware_api_retry_count').with_value(10)
31     should contain_cinder_config('DEFAULT/vmware_max_object_retrieval').with_value(100)
32     should contain_cinder_config('DEFAULT/vmware_task_poll_interval').with_value(5)
33     should contain_cinder_config('DEFAULT/vmware_image_transfer_timeout_secs').with_value(7200)
34     should_not contain_cinder_config('DEFAULT/vmware_wsdl_location')
35   end
36
37   it 'marks vmware_host_password as secret' do
38     should contain_cinder_config('DEFAULT/vmware_host_password').with_secret( true )
39   end
40
41   it 'installs vmdk python driver' do
42     should contain_package('python-suds').with(
43                :ensure => 'present'
44                )
45   end
46
47   context 'with optional parameters' do
48     before :each do
49       params.merge!(optional_params)
50     end
51
52     it 'should configure vmdk driver in cinder.conf' do
53       should contain_cinder_config('DEFAULT/vmware_volume_folder').with_value(params[:volume_folder])
54       should contain_cinder_config('DEFAULT/vmware_api_retry_count').with_value(params[:api_retry_count])
55       should contain_cinder_config('DEFAULT/vmware_max_object_retrieval').with_value(params[:max_object_retrieval])
56       should contain_cinder_config('DEFAULT/vmware_task_poll_interval').with_value(params[:task_poll_interval])
57       should contain_cinder_config('DEFAULT/vmware_image_transfer_timeout_secs').with_value(params[:image_transfer_timeout_secs])
58       should contain_cinder_config('DEFAULT/vmware_wsdl_location').with_value(params[:wsdl_location])
59     end
60   end
61 end