Files
puppet-neutron/spec/unit/provider/neutron_l2gw_service_config/openstackconfig_spec.rb
Takashi Kajinami 604dced76b Adjust service config file for networking-l2gw
... according to the change made by [1].

[1] https://review.opendev.org/c/x/networking-l2gw/+/951422

Change-Id: I3aa562f3ca5371637155d3dca13fb0fab929bdce
Depends-on: https://review.opendev.org/957032
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
2025-08-12 07:47:07 +00:00

52 lines
1.6 KiB
Ruby

require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_l2gw_service_config).provider(:openstackconfig)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_l2gw_service_config.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/networking_l2gw.conf')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_l2gw_service_config.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/networking_l2gw.conf')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_l2gw_service_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::Neutron_l2gw_service_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