Files
puppet-cloudkitty/spec/unit/provider/cloudkitty_api_uwsgi_config/openstackconfig_spec.rb
Thomas Goirand 36bf4eefc5 Add support for cloudkitty_api_uwsgi_config in Debian
This patch is adding the configuration of the number of workers,
threads, and the size of the listen queue in Debian, which uses
uwsgi to run Aodh API. Therefore, this patch adds a new
cloudkitty_api_uwsgi_config provider as well as a new
cloudkitty::wsgi::uwsgi class.

Change-Id: I5d0635800d26327fbdbaa33299927f92eb651fc8
2021-04-12 21:13:04 +02:00

69 lines
2.0 KiB
Ruby

#
# these tests are a little concerning b/c they are hacking around the
# modulepath, so these tests will not catch issues that may eventually arise
# related to loading these plugins.
# I could not, for the life of me, figure out how to programatcally set the modulepath
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:cloudkitty_api_uwsgi_config).provider(:openstackconfig)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Cloudkitty_api_uwsgi_config.new(
{:name => 'DEFAULT/foo', :value => 'bar'}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Cloudkitty_api_uwsgi_config.new(
{:name => 'dude/foo', :value => 'bar'}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Cloudkitty_api_uwsgi_config.new(
{:name => 'dude/foo', :value => '<SERVICE DEFAULT>'}
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
it 'should ensure absent when value matches ensure_absent_val' do
resource = Puppet::Type::Cloudkitty_api_uwsgi_config.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end