File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 22
33require 'spec_helper'
44
5+ RSpec ::Matchers . define_negated_matcher :that_doesnt_notify , :that_notifies
6+ RSpec ::Matchers . define_negated_matcher :that_doesnt_subscribe_to , :that_subscribes_to
7+
58describe 'systemd::dropin_file' do
69 context 'supported operating systems' do
710 on_supported_os . each do |os , facts |
6972
7073 it { is_expected . to compile . with_all_deps }
7174 it { is_expected . to contain_service ( 'myservice' ) . that_subscribes_to ( "File[#{ filename } ]" ) }
72- it { is_expected . to contain_systemd__daemon_reload ( params [ :unit ] ) . that_notifies ( 'Service[myservice]' ) }
75+ it { is_expected . to contain_systemd__daemon_reload ( params [ :unit ] ) . that_comes_before ( 'Service[myservice]' ) }
76+ it { is_expected . to contain_systemd__daemon_reload ( params [ :unit ] ) . that_doesnt_notify ( 'Service[myservice]' ) }
7377 end
7478 end
7579
80+ context 'doesn\'t notify services' do
81+ let ( :params ) do
82+ super ( ) . merge ( notify_service : false )
83+ end
84+ let ( :filename ) { "/etc/systemd/system/#{ params [ :unit ] } .d/#{ title } " }
85+ let ( :pre_condition ) do
86+ <<-PUPPET
87+ service { ['test', 'test.service']:
88+ }
89+ PUPPET
90+ end
91+
92+ it { is_expected . to compile . with_all_deps }
93+ it { is_expected . to contain_service ( 'test' ) . that_doesnt_subscribe_to ( "File[#{ filename } ]" ) }
94+ it { is_expected . to contain_service ( 'test.service' ) . that_doesnt_subscribe_to ( "File[#{ filename } ]" ) }
95+ it { is_expected . to contain_service ( 'test' ) . that_doesnt_subscribe_to ( "Systemd::Daemon_reload[#{ params [ :unit ] } ]" ) }
96+ it { is_expected . to contain_service ( 'test.service' ) . that_doesnt_subscribe_to ( "Systemd::Daemon_reload[#{ params [ :unit ] } ]" ) }
97+ end
98+
99+
76100 context 'with selinux_ignore_defaults set to true' do
77101 let ( :params ) do
78102 super ( ) . merge ( selinux_ignore_defaults : true )
You can’t perform that action at this time.
0 commit comments