File: manila_backend_generic_spec.rb

package info (click to toggle)
puppet-module-manila 27.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,852 kB
  • sloc: ruby: 5,060; python: 33; makefile: 10; sh: 10
file content (90 lines) | stat: -rw-r--r-- 4,022 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
require 'spec_helper'

describe 'manila::backend::generic' do

  let(:title) {'hippo'}

  let :params do
    {
      :driver_handles_share_servers => true,
    }
  end

  shared_examples_for 'manila::backend::generic' do
    context 'with default value' do
      it 'configures generic share driver' do
        is_expected.to contain_manila_config('hippo/share_driver').with_value(
          'manila.share.drivers.generic.GenericShareDriver')
        is_expected.to contain_manila_config('hippo/share_helpers').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('hippo/smb_template_config_path').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('hippo/volume_name_template').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('hippo/volume_snapshot_name_template').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('hippo/share_mount_path').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('hippo/max_time_to_create_volume').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('hippo/max_time_to_attach').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('hippo/service_instance_smb_config_path').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('hippo/share_volume_fstype').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('hippo/share_helpers').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('hippo/cinder_volume_type').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('hippo/delete_share_server_with_last_share').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('hippo/unmanage_remove_access_rules').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('hippo/automatic_share_server_cleanup').with_value('<SERVICE DEFAULT>')
      end
    end

    context 'with parameters' do
      before :each do
        params.merge!({
          :driver_handles_share_servers        => true,
          :smb_template_config_path            => '$state_path/smb.conf',
          :volume_name_template                => 'manila-share-%s',
          :volume_snapshot_name_template       => 'manila-snapshot-%s',
          :share_mount_path                    => '/shares',
          :max_time_to_create_volume           => 180,
          :max_time_to_attach                  => 120,
          :service_instance_smb_config_path    => '$share_mount_path/smb.conf',
          :share_volume_fstype                 => 'ext4',
          :share_helpers                       => 'NFS=manila.share.drivers.helpers.NFSHelper',
          :cinder_volume_type                  => 'gold',
          :delete_share_server_with_last_share => 'True',
          :unmanage_remove_access_rules        => 'True',
          :automatic_share_server_cleanup      => 'False',
        })
      end

      it 'configures generic share driver' do
        params.each_pair do |config,value|
          is_expected.to contain_manila_config("hippo/#{config}").with_value( value )
        end
      end
    end

    context 'with array value' do
      before :each do
        params.merge!({
          :share_helpers => [
            'CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess',
            'NFS=manila.share.drivers.helpers.NFSHelper'
          ]
        })
      end
      it 'configures generic share driver' do
        is_expected.to contain_manila_config('hippo/share_helpers').with_value(
          'CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess,'\
          'NFS=manila.share.drivers.helpers.NFSHelper')
      end
    end
  end

  on_supported_os({
    :supported_os => OSDefaults.get_supported_os
  }).each do |os,facts|
    context "on #{os}" do
      let (:facts) do
        facts.merge!(OSDefaults.get_facts())
      end

      it_behaves_like 'manila::backend::generic'
    end
  end
end