]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/cinder/spec/classes/cinder_volume_netapp_spec.rb
fda68ad368e461fa1ebfaab094a39054ee9e62a5
[dsa-puppet.git] / 3rdparty / modules / cinder / spec / classes / cinder_volume_netapp_spec.rb
1 require 'spec_helper'
2
3 describe 'cinder::volume::netapp' do
4
5   let :params do
6     {
7       :netapp_login           => 'netapp',
8       :netapp_password        => 'password',
9       :netapp_server_hostname => '127.0.0.2',
10     }
11   end
12
13   let :default_params do
14     {
15       :netapp_server_port           => '80',
16       :netapp_size_multiplier       => '1.2',
17       :netapp_storage_family        => 'ontap_cluster',
18       :netapp_storage_protocol      => 'nfs',
19       :netapp_transport_type        => 'http',
20       :netapp_vfiler                => '',
21       :netapp_volume_list           => '',
22       :netapp_vserver               => '',
23       :expiry_thres_minutes         => '720',
24       :thres_avl_size_perc_start    => '20',
25       :thres_avl_size_perc_stop     => '60',
26       :nfs_shares_config            => '/etc/cinder/shares.conf',
27       :netapp_copyoffload_tool_path => '',
28       :netapp_controller_ips        => '',
29       :netapp_sa_password           => '',
30       :netapp_storage_pools         => '',
31       :nfs_mount_options            => nil,
32       :netapp_webservice_path       => '/devmgr/v2',
33     }
34   end
35
36
37   shared_examples_for 'netapp volume driver' do
38     let :params_hash do
39       default_params.merge(params)
40     end
41
42     it 'configures netapp volume driver' do
43       should contain_cinder_config('DEFAULT/volume_driver').with_value(
44         'cinder.volume.drivers.netapp.common.NetAppDriver')
45       params_hash.each_pair do |config,value|
46         should contain_cinder_config("DEFAULT/#{config}").with_value( value )
47       end
48     end
49
50     it 'marks netapp_password as secret' do
51       should contain_cinder_config('DEFAULT/netapp_password').with_secret( true )
52     end
53
54     it 'marks netapp_sa_password as secret' do
55       should contain_cinder_config('DEFAULT/netapp_sa_password').with_secret( true )
56     end
57   end
58
59
60   context 'with default parameters' do
61     before do
62       params = {}
63     end
64
65     it_configures 'netapp volume driver'
66   end
67
68   context 'with provided parameters' do
69     it_configures 'netapp volume driver'
70   end
71
72   context 'with NFS shares provided' do
73     let (:req_params) { params.merge!({
74         :nfs_shares => ['10.0.0.1:/test1', '10.0.0.2:/test2'],
75         :nfs_shares_config => '/etc/cinder/shares.conf',
76     }) }
77
78     it 'writes NFS shares to file' do
79       should contain_file("#{req_params[:nfs_shares_config]}")
80         .with_content("10.0.0.1:/test1\n10.0.0.2:/test2")
81     end
82   end
83 end