memcached (openstack) is no longer in use
[mirror/dsa-puppet.git] / 3rdparty / modules / nova / spec / classes / nova_quota_spec.rb
1 require 'spec_helper'
2
3 describe 'nova::quota' do
4
5   let :params do
6     {}
7   end
8
9   let :default_params do
10     { :quota_instances => 10,
11       :quota_cores => 20,
12       :quota_ram => 51200,
13       :quota_floating_ips => 10,
14       :quota_fixed_ips => -1,
15       :quota_metadata_items => 128,
16       :quota_injected_files => 5,
17       :quota_injected_file_content_bytes => 10240,
18       :quota_injected_file_path_length => 255,
19       :quota_security_groups => 10,
20       :quota_security_group_rules => 20,
21       :quota_key_pairs => 100,
22       :reservation_expire => 86400,
23       :until_refresh => 0,
24       :max_age => 0,
25       :quota_driver => 'nova.quota.DbQuotaDriver' }
26   end
27
28   shared_examples_for 'nova quota' do
29     let :params_hash do
30       default_params.merge(params)
31     end
32
33     it 'configures quota in nova.conf' do
34       params_hash.each_pair do |config,value|
35         should contain_nova_config("DEFAULT/#{config}").with_value( value )
36       end
37     end
38   end
39
40   context 'with default parameters' do
41     it_configures 'nova quota'
42   end
43
44   context 'with provided parameters' do
45     before do
46       params.merge!({
47         :quota_instances => 20,
48         :quota_cores => 40,
49         :quota_ram => 102400,
50         :quota_floating_ips => 20,
51         :quota_fixed_ips => 512,
52         :quota_metadata_items => 256,
53         :quota_injected_files => 10,
54         :quota_injected_file_content_bytes => 20480,
55         :quota_injected_file_path_length => 254,
56         :quota_security_groups => 20,
57         :quota_security_group_rules => 40,
58         :quota_key_pairs => 200,
59         :reservation_expire => 6400,
60         :until_refresh => 30,
61         :max_age => 60
62       })
63     end
64
65     it_configures 'nova quota'
66   end
67
68   context 'with deprecated parameters' do
69     let :params do {
70         :quota_max_injected_files => 10,
71         :quota_max_injected_file_content_bytes => 20480,
72         :quota_injected_file_path_bytes => 254
73       }
74     end
75
76     it {
77       should contain_nova_config('DEFAULT/quota_injected_files').with_value('10')
78       should contain_nova_config('DEFAULT/quota_injected_file_content_bytes').with_value('20480')
79       should contain_nova_config('DEFAULT/quota_injected_file_path_length').with_value('254')
80     }
81   end
82
83   it { should contain_nova_config('DEFAULT/quota_ram').with_value('51200') }
84
85   describe 'when overriding params' do
86
87     let :params do
88       {:quota_ram => '1'}
89     end
90
91     it { should contain_nova_config('DEFAULT/quota_ram').with_value('1') }
92
93   end
94
95 end