File: manila_volume_cinder_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 (93 lines) | stat: -rw-r--r-- 4,576 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
91
92
93
require 'spec_helper'

describe 'manila::volume::cinder' do
  shared_examples 'manila::volume::cinder' do
    context 'with default parameters' do
      let :params do
        {
          :password => 'cinderpass',
        }
      end

      it 'configures manila volume cinder' do
        is_expected.to contain_manila_config('cinder/insecure').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('cinder/auth_url').with_value('http://127.0.0.1:5000')
        is_expected.to contain_manila_config('cinder/auth_type').with_value('password')
        is_expected.to contain_manila_config('cinder/cafile').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('cinder/region_name').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('cinder/timeout').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('cinder/endpoint_type').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('cinder/user_domain_name').with_value('Default')
        is_expected.to contain_manila_config('cinder/project_domain_name').with_value('Default')
        is_expected.to contain_manila_config('cinder/project_name').with_value('services')
        is_expected.to contain_manila_config('cinder/system_scope').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('cinder/username').with_value('cinder')
        is_expected.to contain_manila_config('cinder/password').with_value('cinderpass').with_secret(true)
        is_expected.to contain_manila_config('cinder/http_retries').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('cinder/cross_az_attach').with_value('<SERVICE DEFAULT>')
      end
    end

    context 'with overridden parameters' do
      let :params do
        {
          :insecure        => true,
          :auth_url        => 'http://127.0.0.2:5000/',
          :auth_type       => 'v3password',
          :cafile          => '/etc/ssl/certs/ca.crt',
          :region_name     => 'RegionOne',
          :timeout         => 60,
          :endpoint_type   => 'publicURL',
          :username        => 'cinderv1',
          :password        => 'cinderpass',
          :http_retries    => 3,
          :cross_az_attach => true,
        }
      end

      it 'configures manila cinder with overridden parameters' do
        is_expected.to contain_manila_config('cinder/insecure').with_value(true)
        is_expected.to contain_manila_config('cinder/auth_url').with_value('http://127.0.0.2:5000/')
        is_expected.to contain_manila_config('cinder/auth_type').with_value('v3password')
        is_expected.to contain_manila_config('cinder/cafile').with_value('/etc/ssl/certs/ca.crt')
        is_expected.to contain_manila_config('cinder/user_domain_name').with_value('Default')
        is_expected.to contain_manila_config('cinder/project_domain_name').with_value('Default')
        is_expected.to contain_manila_config('cinder/project_name').with_value('services')
        is_expected.to contain_manila_config('cinder/region_name').with_value('RegionOne')
        is_expected.to contain_manila_config('cinder/timeout').with_value(60)
        is_expected.to contain_manila_config('cinder/system_scope').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('cinder/endpoint_type').with_value('publicURL')
        is_expected.to contain_manila_config('cinder/username').with_value('cinderv1')
        is_expected.to contain_manila_config('cinder/password').with_value('cinderpass').with_secret(true)
        is_expected.to contain_manila_config('cinder/http_retries').with_value(3)
        is_expected.to contain_manila_config('cinder/cross_az_attach').with_value('true')
       end
    end

    context 'when system_scope is set' do
      let :params do
        {
          :password     => 'cinderpass',
          :system_scope => 'all'
        }
      end
      it 'configures system-scoped credential' do
        is_expected.to contain_manila_config('cinder/project_domain_name').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('cinder/project_name').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('cinder/system_scope').with_value('all')
      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::volume::cinder'
    end
  end
end