Assert the exec resource to restart ovs service

This change implements unit tests for the exec resource which was added
by [1].

[1] 1fe71cf5e3

Change-Id: I1dd62d917783f66b11e953ab1c8be6a259553782
This commit is contained in:
Takashi Kajinami
2022-01-13 01:22:26 +09:00
parent 4924354d51
commit 0785d6cbb3
2 changed files with 15 additions and 1 deletions

View File

@@ -57,7 +57,13 @@ describe 'vswitch::dpdk' do
is_expected.to contain_vs_config('other_config:vlan-limit').with(
:value => nil, :wait => true,
)
end
it 'restarts the service when needed' do
is_expected.to contain_exec('restart openvswitch').with(
:path => ['/sbin', '/usr/sbin', '/bin', '/usr/bin'],
:command => "systemctl -q restart %s.service" % platform_params[:ovs_service_name],
:refreshonly => true
)
end
end

View File

@@ -55,6 +55,14 @@ describe 'vswitch::ovs' do
:before => 'Service[openvswitch]'
)
end
it 'restarts the service when needed' do
is_expected.to contain_exec('restart openvswitch').with(
:path => ['/sbin', '/usr/sbin', '/bin', '/usr/bin'],
:command => "systemctl -q restart %s.service" % platform_params[:ovs_service_name],
:refreshonly => true
)
end
end
context 'custom parameters' do