19
19
. that_requires ( 'Package[policycoreutils-python]' )
20
20
end
21
21
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
-
27
22
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]' )
32
26
end
33
27
34
28
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' )
37
30
end
38
31
39
32
context 'RHEL 7 host with Puppet 5' do
40
33
include_examples 'RedHat 7'
41
34
42
35
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' ,
45
38
refreshonly : true ,
46
39
path : '/bin:/usr/bin:/usr/local/bin' ,
47
40
)
53
46
<<-EOS
54
47
class { 'postgresql::globals':
55
48
manage_package_repo => true,
56
- version => '9.4 ',
49
+ version => '10 ',
57
50
}->
58
51
class { 'postgresql::server': }
59
52
EOS
60
53
end
61
54
62
55
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' ,
66
58
)
67
59
end
68
60
69
61
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} )
71
63
end
72
64
end
73
65
end
@@ -84,41 +76,34 @@ class { 'postgresql::server': }
84
76
. that_requires ( 'Package[policycoreutils-python-utils]' )
85
77
end
86
78
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
-
92
79
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]' )
97
83
end
98
84
99
85
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} )
101
87
end
102
88
103
89
describe 'with manage_package_repo => true and a version' do
104
90
let ( :pre_condition ) do
105
91
<<-EOS
106
92
class { 'postgresql::globals':
107
93
manage_package_repo => true,
108
- version => '9.4 ',
94
+ version => '14 ',
109
95
}->
110
96
class { 'postgresql::server': }
111
97
EOS
112
98
end
113
99
114
100
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' ,
118
103
)
119
104
end
120
105
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} )
122
107
end
123
108
end
124
109
end
@@ -135,20 +120,14 @@ class { 'postgresql::server': }
135
120
. that_requires ( 'Package[policycoreutils-python-utils]' )
136
121
end
137
122
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
-
143
123
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]' )
148
127
end
149
128
150
129
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} )
152
131
end
153
132
154
133
describe 'with manage_package_repo => true and a version' do
@@ -163,14 +142,13 @@ class { 'postgresql::server': }
163
142
end
164
143
165
144
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' ,
169
147
)
170
148
end
171
149
172
150
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} )
174
152
end
175
153
end
176
154
end
@@ -193,7 +171,7 @@ class { 'postgresql::server': }
193
171
let ( :pre_condition ) do
194
172
<<-EOS
195
173
class { 'postgresql::globals':
196
- version => '9.5 ',
174
+ version => '14 ',
197
175
}->
198
176
class { 'postgresql::server':
199
177
manage_pg_hba_conf => true,
@@ -221,7 +199,7 @@ class { 'postgresql::server':
221
199
let ( :pre_condition ) do
222
200
<<-EOS
223
201
class { 'postgresql::globals':
224
- version => '9.5 ',
202
+ version => '14 ',
225
203
}->
226
204
class { 'postgresql::server': }
227
205
EOS
@@ -231,22 +209,11 @@ class { 'postgresql::server': }
231
209
is_expected . not_to contain_exec ( '/usr/sbin/semanage port -a -t postgresql_port_t -p tcp 5432' )
232
210
end
233
211
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
-
239
212
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' ,
243
215
)
244
216
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
250
217
end
251
218
end
252
219
end
0 commit comments