Skip to content

Commit

Permalink
test: add tests for not reloading service
Browse files Browse the repository at this point in the history
  • Loading branch information
shieldwed committed Feb 8, 2024
1 parent 7ac0fe0 commit d47d3e9
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion spec/defines/dropin_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,32 @@

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_service('myservice').that_subscribes_to("File[#{filename}]") }
it { is_expected.to contain_systemd__daemon_reload(params[:unit]).that_notifies('Service[myservice]') }
it { is_expected.not_to contain_systemd__daemon_reload(params[:unit]).that_notifies('Service[myservice]') }
it { is_expected.to contain_systemd__daemon_reload(params[:unit]).that_comes_before('Service[myservice]') }
end
end

context 'doesn\'t notify services' do
let(:params) do
super().merge(notify_service: false)
end
let(:filename) { "/etc/systemd/system/#{params[:unit]}.d/#{title}" }
let(:pre_condition) do
<<-PUPPET
service { ['test', 'test.service']:
}
PUPPET
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_service('test') }
it { is_expected.not_to contain_service('test').that_subscribes_to("File[#{filename}]") }
it { is_expected.not_to contain_service('test').that_subscribes_to("Systemd::Daemon_reload[#{params[:unit]}]") }
it { is_expected.to contain_service('test.service') }
it { is_expected.not_to contain_service('test.service').that_subscribes_to("File[#{filename}]") }
it { is_expected.not_to contain_service('test.service').that_subscribes_to("Systemd::Daemon_reload[#{params[:unit]}]") }
end

context 'with selinux_ignore_defaults set to true' do
let(:params) do
super().merge(selinux_ignore_defaults: true)
Expand Down

0 comments on commit d47d3e9

Please sign in to comment.