File: nova_quota_spec.rb

package info (click to toggle)
puppet-module-nova 25.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,100 kB
  • sloc: ruby: 11,433; python: 38; sh: 10; makefile: 10
file content (77 lines) | stat: -rw-r--r-- 2,355 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
require 'spec_helper'

describe 'nova::quota' do
  let :params do
    {}
  end

  let :default_params do
    {
      :driver                      => '<SERVICE DEFAULT>',
      :instances                   => '<SERVICE DEFAULT>',
      :cores                       => '<SERVICE DEFAULT>',
      :ram                         => '<SERVICE DEFAULT>',
      :metadata_items              => '<SERVICE DEFAULT>',
      :injected_files              => '<SERVICE DEFAULT>',
      :injected_file_content_bytes => '<SERVICE DEFAULT>',
      :injected_file_path_length   => '<SERVICE DEFAULT>',
      :key_pairs                   => '<SERVICE DEFAULT>',
      :server_groups               => '<SERVICE DEFAULT>',
      :server_group_members        => '<SERVICE DEFAULT>',
      :recheck_quota               => '<SERVICE DEFAULT>',
      :count_usage_from_placement  => '<SERVICE DEFAULT>',
    }
  end

  shared_examples 'nova::quota config options' do
    let :params_hash do
      default_params.merge!(params)
    end

    it {
      params_hash.each_pair do |config, value|
        should contain_nova_config("quota/#{config}").with_value(value)
      end
    }
  end

  shared_examples 'nova::quota' do
    context 'with default parameters' do
      it_behaves_like 'nova::quota config options'
    end

    context 'with provided parameters' do
      before do
        params.merge!({
          :driver                      => 'nova.quota.DbQuotaDriver',
          :instances                   => 20,
          :cores                       => 40,
          :ram                         => 102400,
          :metadata_items              => 256,
          :injected_files              => 10,
          :injected_file_content_bytes => 20480,
          :injected_file_path_length   => 254,
          :key_pairs                   => 200,
          :server_groups               => 20,
          :server_group_members        => 20,
          :recheck_quota               => true,
          :count_usage_from_placement  => false,
        })
      end

      it_behaves_like 'nova::quota config options'
    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 'nova::quota'
    end
  end
end