Files
puppet-cloudkitty/spec/unit/provider/cloudkitty_config/openstackconfig_spec.rb
Takashi Kajinami b13a35dd3a Add support for MultiStrOpt
This replaces the provider implementation of cloudkitty_config type so
that MultiStrOpt, which is used by several options like
 - oslo_messaging_notifications/driver
 - oslo_policy/policy_dirs
are handled correctly.

Change-Id: Iefdfa5b83cb1f5ff691cc38e0f691babac9bdfb0
2022-02-13 00:22:44 +09:00

42 lines
1.3 KiB
Ruby

require 'spec_helper'
provider_class = Puppet::Type.type(:cloudkitty_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_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_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_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_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