puppet-cinder/spec/classes/cinder_quota_spec.rb
Alex Schultz a21a3ee581 Move default values to $::os_service_default
This change updates the values that are currently defined but are the
service defaults to use the $::os_service_default fact.

The volume/ and backend/ values will be updated in a follow on patch.

Change-Id: I2a78f0966be5f18835b06be31d69e8c09e217b32
2015-10-29 09:32:46 -05:00

61 lines
1.8 KiB
Ruby

require 'spec_helper'
describe 'cinder::quota' do
let :default_params do
{ :quota_volumes => '<SERVICE DEFAULT>',
:quota_snapshots => '<SERVICE DEFAULT>',
:quota_gigabytes => '<SERVICE DEFAULT>',
:quota_driver => '<SERVICE DEFAULT>' }
end
let :params do
{}
end
shared_examples_for 'cinder quota' do
let :p do
default_params.merge(params)
end
it 'contains default values' do
is_expected.to contain_cinder_config('DEFAULT/quota_volumes').with_value(p[:quota_volumes])
is_expected.to contain_cinder_config('DEFAULT/quota_snapshots').with_value(p[:quota_snapshots])
is_expected.to contain_cinder_config('DEFAULT/quota_gigabytes').with_value(p[:quota_gigabytes])
is_expected.to contain_cinder_config('DEFAULT/quota_driver').with_value(p[:quota_driver])
end
context 'configure quota with parameters' do
before :each do
params.merge!({ :quota_volumes => 1000,
:quota_snapshots => 1000,
:quota_gigabytes => 100000 })
end
it 'contains overrided values' do
is_expected.to contain_cinder_config('DEFAULT/quota_volumes').with_value(p[:quota_volumes])
is_expected.to contain_cinder_config('DEFAULT/quota_snapshots').with_value(p[:quota_snapshots])
is_expected.to contain_cinder_config('DEFAULT/quota_gigabytes').with_value(p[:quota_gigabytes])
is_expected.to contain_cinder_config('DEFAULT/quota_driver').with_value(p[:quota_driver])
end
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
end
it_configures 'cinder quota'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
it_configures 'cinder quota'
end
end