puppet-neutron/spec/classes/neutron_quota_spec.rb
Cody Herriges ccac02b917 Make tests pass on Puppet 4.x
This commit makes the following changes, mostly to specs to get them
  passing on Puppet 4.x: removes redefinition of $name because it is now
  a reserved word and redundant in Puppet 3.x, cleans up the use of
  Puppet's old behavior of implicitly converting String to Integers
  since Puppet 4.x is pretty strictly typed, sets facts required for
  doing flow control and comparison, fixes implicit use of empty string
  that is assumed to be the same as false by updating tests that inject
  empty string into params to represent a value not being provide by a
  user to false instead.

Closes-bug: #1447620
Change-Id: Ibb651f26f33549dbe564dc88167b8f578a03fd77
2015-06-16 09:57:29 -07:00

79 lines
2.3 KiB
Ruby

require 'spec_helper'
describe 'neutron::quota' do
let :params do
{}
end
let :default_params do
{ :default_quota => -1,
:quota_network => 10,
:quota_subnet => 10,
:quota_port => 50,
:quota_router => 10,
:quota_floatingip => 50,
:quota_security_group => 10,
:quota_security_group_rule => 100,
:quota_driver => 'neutron.db.quota_db.DbQuotaDriver',
:quota_firewall => 1,
:quota_firewall_policy => 1,
:quota_firewall_rule => -1,
:quota_health_monitor => -1,
:quota_items => 'network,subnet,port',
:quota_member => -1,
:quota_network_gateway => 5,
:quota_packet_filter => 100,
:quota_pool => 10,
:quota_vip => 10 }
end
let :facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
shared_examples_for 'neutron quota' do
let :params_hash do
default_params.merge(params)
end
it 'configures quota in neutron.conf' do
params_hash.each_pair do |config,value|
is_expected.to contain_neutron_config("quotas/#{config}").with_value( value )
end
end
end
context 'with default parameters' do
it_configures 'neutron quota'
end
context 'with provided parameters' do
before do
params.merge!({
:quota_network => 20,
:quota_subnet => 20,
:quota_port => 100,
:quota_router => 20,
:quota_floatingip => 100,
:quota_security_group => 20,
:quota_security_group_rule => 200,
:quota_firewall => 1,
:quota_firewall_policy => 1,
:quota_firewall_rule => -1,
:quota_health_monitor => -1,
:quota_items => 'network,subnet,port',
:quota_member => -1,
:quota_network_gateway => 5,
:quota_packet_filter => 100,
:quota_pool => 10,
:quota_vip => 10
})
end
it_configures 'neutron quota'
end
end