File: cinder_quota_set_spec.rb

package info (click to toggle)
puppet-module-cinder 25.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,504 kB
  • sloc: ruby: 6,697; python: 38; sh: 10; makefile: 10
file content (67 lines) | stat: -rw-r--r-- 2,074 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
66
67
#Author: Craig DeLatte <craig.delatte@twcable.com>

require 'spec_helper'

describe 'cinder::quota_set' do
  let(:title) {'hippo'}

  let :params do
    {
      :os_password     => 'asdf',
      :os_tenant_name  => 'admin',
      :os_username     => 'admin',
      :os_auth_url     => 'http://127.127.127.1:5000/v3/',
      :quota_volumes   => '10',
      :quota_snapshots => '10',
      :quota_gigabytes => '1000',
      :class_name      => 'default',
    }
  end

  shared_examples 'cinder::quota_set' do
    context 'with specified parameters' do
      it { is_expected.to contain_exec('openstack quota set --class default').with(
        :command     => "openstack quota set --class default --volumes 10 --snapshots 10 --gigabytes 1000 --volume-type 'hippo'",
        :environment => [
          'OS_TENANT_NAME=admin',
          'OS_USERNAME=admin',
          'OS_PASSWORD=asdf',
          'OS_AUTH_URL=http://127.127.127.1:5000/v3/',
        ],
        :onlyif      => 'openstack quota show --class default | grep -qP -- -1',
        :require     => 'Anchor[cinder::service::end]',
      )}
    end

    context 'with region name set' do
      before do
        params.merge!( :os_region_name => 'test' )
      end

      it { is_expected.to contain_exec('openstack quota set --class default').with(
        :command     => "openstack quota set --class default --volumes 10 --snapshots 10 --gigabytes 1000 --volume-type 'hippo'",
        :environment => [
          'OS_TENANT_NAME=admin',
          'OS_USERNAME=admin',
          'OS_PASSWORD=asdf',
          'OS_AUTH_URL=http://127.127.127.1:5000/v3/',
          'OS_REGION_NAME=test',
        ],
        :onlyif      => 'openstack quota show --class default | grep -qP -- -1',
        :require     => 'Anchor[cinder::service::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 'cinder::quota_set'
    end
  end
end