| 1 |
require 'spec_helper' |
| 2 |
|
| 3 |
describe 'nova::quota' do |
| 4 |
let :params do |
| 5 |
{} |
| 6 |
end |
| 7 |
|
| 8 |
let :default_params do |
| 9 |
{ |
| 10 |
:driver => '<SERVICE DEFAULT>', |
| 11 |
:instances => '<SERVICE DEFAULT>', |
| 12 |
:cores => '<SERVICE DEFAULT>', |
| 13 |
:ram => '<SERVICE DEFAULT>', |
| 14 |
:metadata_items => '<SERVICE DEFAULT>', |
| 15 |
:injected_files => '<SERVICE DEFAULT>', |
| 16 |
:injected_file_content_bytes => '<SERVICE DEFAULT>', |
| 17 |
:injected_file_path_length => '<SERVICE DEFAULT>', |
| 18 |
:key_pairs => '<SERVICE DEFAULT>', |
| 19 |
:server_groups => '<SERVICE DEFAULT>', |
| 20 |
:server_group_members => '<SERVICE DEFAULT>', |
| 21 |
:recheck_quota => '<SERVICE DEFAULT>', |
| 22 |
:count_usage_from_placement => '<SERVICE DEFAULT>', |
| 23 |
:unified_limits_resource_strategy => '<SERVICE DEFAULT>', |
| 24 |
:unified_limits_resource_list => '<SERVICE DEFAULT>', |
| 25 |
} |
| 26 |
end |
| 27 |
|
| 28 |
shared_examples 'nova::quota config options' do |
| 29 |
let :params_hash do |
| 30 |
default_params.merge!(params) |
| 31 |
end |
| 32 |
|
| 33 |
it { |
| 34 |
params_hash.each_pair do |config, value| |
| 35 |
should contain_nova_config("quota/#{config}").with_value(value) |
| 36 |
end |
| 37 |
} |
| 38 |
end |
| 39 |
|
| 40 |
shared_examples 'nova::quota' do |
| 41 |
context 'with default parameters' do |
| 42 |
it_behaves_like 'nova::quota config options' |
| 43 |
end |
| 44 |
|
| 45 |
context 'with provided parameters' do |
| 46 |
before do |
| 47 |
params.merge!({ |
| 48 |
:driver => 'nova.quota.DbQuotaDriver', |
| 49 |
:instances => 20, |
| 50 |
:cores => 40, |
| 51 |
:ram => 102400, |
| 52 |
:metadata_items => 256, |
| 53 |
:injected_files => 10, |
| 54 |
:injected_file_content_bytes => 20480, |
| 55 |
:injected_file_path_length => 254, |
| 56 |
:key_pairs => 200, |
| 57 |
:server_groups => 20, |
| 58 |
:server_group_members => 20, |
| 59 |
:recheck_quota => true, |
| 60 |
:count_usage_from_placement => false, |
| 61 |
:unified_limits_resource_strategy => 'require', |
| 62 |
:unified_limits_resource_list => 'servers', |
| 63 |
}) |
| 64 |
end |
| 65 |
|
| 66 |
it_behaves_like 'nova::quota config options' |
| 67 |
end |
| 68 |
end |
| 69 |
|
| 70 |
on_supported_os({ |
| 71 |
:supported_os => OSDefaults.get_supported_os |
| 72 |
}).each do |os,facts| |
| 73 |
context "on #{os}" do |
| 74 |
let (:facts) do |
| 75 |
facts.merge!(OSDefaults.get_facts()) |
| 76 |
end |
| 77 |
|
| 78 |
it_behaves_like 'nova::quota' |
| 79 |
end |
| 80 |
end |
| 81 |
end |