1919 . that_requires ( 'Package[policycoreutils-python]' )
2020 end
2121
22- it 'removes the old systemd-override file' do
23- is_expected . to contain_file ( 'old-systemd-override' )
24- . with ( ensure : 'absent' , path : '/etc/systemd/system/postgresql.service' )
25- end
26-
2722 it 'has the correct systemd-override drop file' do
28- is_expected . to contain_file ( 'systemd-override' ) . with (
29- ensure : 'file' , path : '/etc/systemd/system/postgresql.service.d/postgresql.conf' ,
30- owner : 'root' , group : 'root'
31- ) . that_requires ( 'File[systemd-conf-dir]' )
23+ is_expected . to contain_file ( '/etc/systemd/system/postgresql.service.d/postgresql.conf' ) . with (
24+ ensure : 'file' , owner : 'root' , group : 'root' ,
25+ ) . that_requires ( 'File[/etc/systemd/system/postgresql.service.d]' )
3226 end
3327
3428 it 'has the correct systemd-override file #regex' do
35- is_expected . to contain_file ( 'systemd-override' ) \
36- . with_content ( %r{(?!^.include)} )
29+ is_expected . to contain_file ( '/etc/systemd/system/postgresql.service.d/postgresql.conf' )
3730 end
3831
3932 context 'RHEL 7 host with Puppet 5' do
4033 include_examples 'RedHat 7'
4134
4235 it 'has systemctl restart command' do
43- is_expected . to contain_exec ( 'restart- systemd' ) . with (
44- command : [ 'systemctl' , ' daemon-reload'] ,
36+ is_expected . to contain_exec ( 'systemd-postgresql.service-systemctl-daemon-reload ' ) . with (
37+ command : 'systemctl daemon-reload' ,
4538 refreshonly : true ,
4639 path : '/bin:/usr/bin:/usr/local/bin' ,
4740 )
5346 <<-EOS
5447 class { 'postgresql::globals':
5548 manage_package_repo => true,
56- version => '9.4 ',
49+ version => '10 ',
5750 }->
5851 class { 'postgresql::server': }
5952 EOS
6053 end
6154
6255 it 'has the correct systemd-override file' do
63- is_expected . to contain_file ( 'systemd-override' ) . with (
64- ensure : 'file' , path : '/etc/systemd/system/postgresql-9.4.service.d/postgresql-9.4.conf' ,
65- owner : 'root' , group : 'root'
56+ is_expected . to contain_file ( '/etc/systemd/system/postgresql-10.service.d/postgresql-10.conf' ) . with (
57+ ensure : 'file' , owner : 'root' , group : 'root' ,
6658 )
6759 end
6860
6961 it 'has the correct systemd-override file #regex' do
70- is_expected . to contain_file ( 'systemd-override ' ) . without_content ( %r{\. include} )
62+ is_expected . to contain_file ( '/etc/ systemd/system/postgresql-10.service.d/postgresql-10.conf ' ) . without_content ( %r{\. include} )
7163 end
7264 end
7365 end
@@ -84,41 +76,34 @@ class { 'postgresql::server': }
8476 . that_requires ( 'Package[policycoreutils-python-utils]' )
8577 end
8678
87- it 'removes the old systemd-override file' do
88- is_expected . to contain_file ( 'old-systemd-override' )
89- . with ( ensure : 'absent' , path : '/etc/systemd/system/postgresql.service' )
90- end
91-
9279 it 'has the correct systemd-override drop file' do
93- is_expected . to contain_file ( 'systemd-override' ) . with (
94- ensure : 'file' , path : '/etc/systemd/system/postgresql.service.d/postgresql.conf' ,
95- owner : 'root' , group : 'root'
96- ) . that_requires ( 'File[systemd-conf-dir]' )
80+ is_expected . to contain_file ( '/etc/systemd/system/postgresql.service.d/postgresql.conf' ) . with (
81+ ensure : 'file' , owner : 'root' , group : 'root' ,
82+ ) . that_requires ( 'File[/etc/systemd/system/postgresql.service.d]' )
9783 end
9884
9985 it 'has the correct systemd-override file #regex' do
100- is_expected . to contain_file ( 'systemd-override' ) . without_content ( %r{\. include} )
86+ is_expected . to contain_file ( '/etc/ systemd/system/postgresql.service.d/postgresql.conf' ) . without_content ( %r{\. include} )
10187 end
10288
10389 describe 'with manage_package_repo => true and a version' do
10490 let ( :pre_condition ) do
10591 <<-EOS
10692 class { 'postgresql::globals':
10793 manage_package_repo => true,
108- version => '9.4 ',
94+ version => '14 ',
10995 }->
11096 class { 'postgresql::server': }
11197 EOS
11298 end
11399
114100 it 'has the correct systemd-override file' do
115- is_expected . to contain_file ( 'systemd-override' ) . with (
116- ensure : 'file' , path : '/etc/systemd/system/postgresql-9.4.service.d/postgresql-9.4.conf' ,
117- owner : 'root' , group : 'root'
101+ is_expected . to contain_file ( '/etc/systemd/system/postgresql-14.service.d/postgresql-14.conf' ) . with (
102+ ensure : 'file' , owner : 'root' , group : 'root' ,
118103 )
119104 end
120105 it 'has the correct systemd-override file #regex' do
121- is_expected . to contain_file ( 'systemd-override ' ) . without_content ( %r{\. include} )
106+ is_expected . to contain_file ( '/etc/ systemd/system/postgresql-14.service.d/postgresql-14.conf ' ) . without_content ( %r{\. include} )
122107 end
123108 end
124109 end
@@ -135,20 +120,14 @@ class { 'postgresql::server': }
135120 . that_requires ( 'Package[policycoreutils-python-utils]' )
136121 end
137122
138- it 'removes the old systemd-override file' do
139- is_expected . to contain_file ( 'old-systemd-override' )
140- . with ( ensure : 'absent' , path : '/etc/systemd/system/postgresql.service' )
141- end
142-
143123 it 'has the correct systemd-override drop file' do
144- is_expected . to contain_file ( 'systemd-override' ) . with (
145- ensure : 'file' , path : '/etc/systemd/system/postgresql.service.d/postgresql.conf' ,
146- owner : 'root' , group : 'root'
147- ) . that_requires ( 'File[systemd-conf-dir]' )
124+ is_expected . to contain_file ( '/etc/systemd/system/postgresql.service.d/postgresql.conf' ) . with (
125+ ensure : 'file' , owner : 'root' , group : 'root' ,
126+ ) . that_requires ( 'File[/etc/systemd/system/postgresql.service.d]' )
148127 end
149128
150129 it 'has the correct systemd-override file #regex' do
151- is_expected . to contain_file ( 'systemd-override' ) . without_content ( %r{\. include} )
130+ is_expected . to contain_file ( '/etc/ systemd/system/postgresql.service.d/postgresql.conf' ) . without_content ( %r{\. include} )
152131 end
153132
154133 describe 'with manage_package_repo => true and a version' do
@@ -163,14 +142,13 @@ class { 'postgresql::server': }
163142 end
164143
165144 it 'has the correct systemd-override file' do
166- is_expected . to contain_file ( 'systemd-override' ) . with (
167- ensure : 'file' , path : '/etc/systemd/system/postgresql-13.service.d/postgresql-13.conf' ,
168- owner : 'root' , group : 'root'
145+ is_expected . to contain_file ( '/etc/systemd/system/postgresql-13.service.d/postgresql-13.conf' ) . with (
146+ ensure : 'file' , owner : 'root' , group : 'root' ,
169147 )
170148 end
171149
172150 it 'has the correct systemd-override file #regex' do
173- is_expected . to contain_file ( 'systemd-override ' ) . without_content ( %r{\. include} )
151+ is_expected . to contain_file ( '/etc/ systemd/system/postgresql-13.service.d/postgresql-13.conf ' ) . without_content ( %r{\. include} )
174152 end
175153 end
176154 end
@@ -193,7 +171,7 @@ class { 'postgresql::server': }
193171 let ( :pre_condition ) do
194172 <<-EOS
195173 class { 'postgresql::globals':
196- version => '9.5 ',
174+ version => '14 ',
197175 }->
198176 class { 'postgresql::server':
199177 manage_pg_hba_conf => true,
@@ -221,7 +199,7 @@ class { 'postgresql::server':
221199 let ( :pre_condition ) do
222200 <<-EOS
223201 class { 'postgresql::globals':
224- version => '9.5 ',
202+ version => '14 ',
225203 }->
226204 class { 'postgresql::server': }
227205 EOS
@@ -231,22 +209,11 @@ class { 'postgresql::server': }
231209 is_expected . not_to contain_exec ( '/usr/sbin/semanage port -a -t postgresql_port_t -p tcp 5432' )
232210 end
233211
234- it 'removes the old systemd-override file' do
235- is_expected . to contain_file ( 'old-systemd-override' )
236- . with ( ensure : 'absent' , path : '/etc/systemd/system/postgresql-9.5.service' )
237- end
238-
239212 it 'has the correct systemd-override drop file' do
240- is_expected . to contain_file ( 'systemd-override' ) . with (
241- ensure : 'file' , path : '/etc/systemd/system/postgresql-9.5.service.d/postgresql-9.5.conf' ,
242- owner : 'root' , group : 'root'
213+ is_expected . to contain_file ( '/etc/systemd/system/postgresql-14.service.d/postgresql-14.conf' ) . with (
214+ ensure : 'file' , owner : 'root' , group : 'root' ,
243215 )
244216 end
245-
246- it 'has the correct systemd-override file #regex' do
247- is_expected . to contain_file ( 'systemd-override' ) \
248- . with_content ( %r{(?!^.include)} )
249- end
250217 end
251218 end
252219end
0 commit comments