puppet-neutron/spec/classes/neutron_agents_bigswitch_spec.rb
Takashi Kajinami ce4c032d17 Fix ignored unit test cases
Change-Id: Ibb0b7bcc268752802f3413648e6828fd4999cc9b
2021-01-03 14:49:53 +09:00

90 lines
2.2 KiB
Ruby

require 'spec_helper'
describe 'neutron::agents::bigswitch' do
let :pre_condition do
"class { 'neutron': }"
end
shared_examples 'neutron::agents::bigswitch' do
context 'neutron bigswitch base' do
it 'should have' do
should contain_package('python3-networking-bigswitch').with(
:ensure => 'present',
:tag => ['openstack', 'neutron-package'],
)
end
end
context 'neutron-bsn-agent only' do
let :params do
{
:lldp_enabled => false,
:agent_enabled => true
}
end
it 'enable neutron-bsn-agent service' do
should contain_service('bigswitch-agent').with(
:enable => params[:agent_enabled],
:ensure =>'running',
:tag =>'neutron-service',
)
end
it 'disable neutron-bsn-lldp service' do
should contain_service('bigswitch-lldp').with(
:enable => params[:lldp_enabled],
:ensure =>'stopped',
:tag =>'neutron-service',
)
end
end
context 'neutron-bsn-lldp only' do
let :params do
{
:lldp_enabled => true,
:agent_enabled => false
}
end
it 'disable neutron-bsn-agent service' do
should contain_service('bigswitch-agent').with(
:enable => params[:agent_enabled],
:ensure =>'stopped',
:tag =>'neutron-service',
)
end
it 'enable neutron-bsn-lldp service' do
should contain_service('bigswitch-lldp').with(
:enable => params[:lldp_enabled],
:ensure =>'running',
:tag =>'neutron-service',
)
end
end
end
shared_examples 'neutron::agents::bigswitch on Debian' do
it { should raise_error(Puppet::Error, /Unsupported osfamily Debian/) }
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
if facts[:osfamily] == 'Debian'
it_behaves_like 'neutron::agents::bigswitch on Debian'
else
it_behaves_like 'neutron::agents::bigswitch'
end
end
end
end