File: manila_backend_hitachi_hnas_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 (65 lines) | stat: -rw-r--r-- 2,057 bytes parent folder | download | duplicates (2)
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
require 'spec_helper'

describe 'manila::backend::hitachi_hnas' do

  let(:title) {'myhitachinas'}

  let :params do
    {
      :driver_handles_share_servers            => false,
      :hitachi_hnas_ip                         => '172.24.44.15',
      :hitachi_hnas_user                       => 'supervisor',
      :hitachi_hnas_password                   => 'supervisor',
      :hitachi_hnas_evs_id                     => '1',
      :hitachi_hnas_evs_ip                     => ' 172.24.53.1',
      :hitachi_hnas_file_system_name           => 'FS-Manila',
      :backend_availability_zone               => 'my_zone',
      :reserved_share_percentage               => 10.0,
      :reserved_share_from_snapshot_percentage => 10.1,
      :reserved_share_extend_percentage        => 10.2,
      :max_over_subscription_ratio             => 1.5,
    }
  end

  shared_examples_for 'hitachi hnas share driver' do
    it 'configures hitachi nas share driver' do
      is_expected.to contain_manila_config("myhitachinas/share_driver").with_value(
        'manila.share.drivers.hitachi.hds_hnas.HDSHNASDriver')
      params.each_pair do |config,value|
        is_expected.to contain_manila_config("myhitachinas/#{config}").with_value( value )
      end
    end

    it 'marks hitachi_hnas_password as secret' do
      is_expected.to contain_manila_config("myhitachinas/hitachi_hnas_password").with_secret( true )
    end
  end

  shared_examples 'manila::backend::hitachi_hnas' do
    context 'with provided parameters' do
      it_configures 'hitachi hnas share driver'
    end

    context 'with share server config' do
      before do
        params.merge!({
          :hitachi_hnas_password => true,
        })
      end

      it { is_expected.to raise_error(Puppet::Error) }
    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::hitachi_hnas'
    end
  end
end