Files
puppet-neutron/spec/unit/provider/neutron_agent_ovn/ini_setting_spec.rb
Rodolfo Alonso Hernandez 240ba0babd Add support for the OVN Neutron Agent service
This patch adds support for the OVN Neutron Agent service [1].

This new agent will include any needed OVN functionality not
implemented in ovn-controller. This agent will, in a future, include
the metadata service, superseding the OVN Metadata Agent.

[1]https://review.opendev.org/c/openstack/neutron-specs/+/868076

Related-Bug: #2000385
Related-Bug: #1998608
Change-Id: I14a3868d991fbbb3472e29a7796aa61e8d225b98
2023-03-28 14:02:33 +09:00

51 lines
1.5 KiB
Ruby

require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_agent_ovn).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Neutron_agent_ovn.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/plugins/ml2/ovn_agent.ini')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Neutron_agent_ovn.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/plugins/ml2/ovn_agent.ini')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Neutron_agent_ovn.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_agent_ovn.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