File tree 1 file changed +24
-1
lines changed
1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
require 'spec_helper'
4
4
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
+
5
8
describe 'systemd::dropin_file' do
6
9
context 'supported operating systems' do
7
10
on_supported_os . each do |os , facts |
69
72
70
73
it { is_expected . to compile . with_all_deps }
71
74
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]' ) }
77
+ end
78
+ end
79
+
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
73
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 ] } ]" ) }
74
97
end
75
98
76
99
context 'with selinux_ignore_defaults set to true' do
You can’t perform that action at this time.
0 commit comments