|
79 | 79 | describe "#start" do
|
80 | 80 | it "should use the supplied start command if specified" do
|
81 | 81 | provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :start => '/bin/foo'))
|
82 |
| - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true) |
| 82 | + expect(provider).to receive(:execute).with(['/bin/foo'], :combine => true, :failonfail => true, :override_locale => false, :priority => 0, :squelch => false) |
83 | 83 | provider.start
|
84 | 84 | end
|
85 | 85 |
|
86 | 86 | it "should start the service with <initscript> start otherwise" do
|
87 | 87 | provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
|
88 |
| - expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:start], :failonfail => true, :override_locale => false, :squelch => false, :combine => true) |
| 88 | + expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:start], :combine => true, :failonfail => true, :override_locale => false, :priority => 0, :squelch => false) |
89 | 89 | expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
|
90 | 90 | provider.start
|
91 | 91 | end
|
|
94 | 94 | describe "#stop" do
|
95 | 95 | it "should use the supplied stop command if specified" do
|
96 | 96 | provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :stop => '/bin/foo'))
|
97 |
| - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true) |
| 97 | + expect(provider).to receive(:execute).with(['/bin/foo'], :combine => true, :failonfail => true, :override_locale => false, :priority => 0, :squelch => false) |
98 | 98 | provider.stop
|
99 | 99 | end
|
100 | 100 |
|
101 | 101 | it "should stop the service with <initscript> stop otherwise" do
|
102 | 102 | provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
|
103 |
| - expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:stop], :failonfail => true, :override_locale => false, :squelch => false, :combine => true) |
| 103 | + expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:stop], :combine => true, :failonfail => true, :override_locale => false, :priority => 0, :squelch => false) |
104 | 104 | expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
|
105 | 105 | provider.stop
|
106 | 106 | end
|
|
160 | 160 | describe "when a special status command is specified" do
|
161 | 161 | it "should use the status command from the resource" do
|
162 | 162 | provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
|
163 |
| - expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) |
164 |
| - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) |
| 163 | + expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :combine => true, :failonfail => false, :override_locale => false, :priority => 0, :squelch => false) |
| 164 | + expect(provider).to receive(:execute).with(['/bin/foo'], :combine => true, :failonfail => false, :override_locale => false, :priority => 0, :squelch => false) |
165 | 165 | allow($CHILD_STATUS).to receive(:exitstatus).and_return(0)
|
166 | 166 | provider.status
|
167 | 167 | end
|
168 | 168 |
|
169 | 169 | it "should return :stopped when the status command returns with a non-zero exitcode" do
|
170 | 170 | provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
|
171 |
| - expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) |
172 |
| - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) |
| 171 | + expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :combine => true, :failonfail => false, :override_locale => false, :priority => 0, :squelch => false) |
| 172 | + expect(provider).to receive(:execute).with(['/bin/foo'], :combine => true, :failonfail => false, :override_locale => false, :priority => 0, :squelch => false) |
173 | 173 | allow($CHILD_STATUS).to receive(:exitstatus).and_return(3)
|
174 | 174 | expect(provider.status).to eq(:stopped)
|
175 | 175 | end
|
176 | 176 |
|
177 | 177 | it "should return :running when the status command returns with a zero exitcode" do
|
178 | 178 | provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
|
179 |
| - expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) |
180 |
| - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) |
| 179 | + expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :combine => true, :failonfail => false, :override_locale => false, :priority => 0, :squelch => false) |
| 180 | + expect(provider).to receive(:execute).with(['/bin/foo'], :combine => true, :failonfail => false, :override_locale => false, :priority => 0, :squelch => false) |
181 | 181 | allow($CHILD_STATUS).to receive(:exitstatus).and_return(0)
|
182 | 182 | expect(provider.status).to eq(:running)
|
183 | 183 | end
|
|
186 | 186 | describe "when hasstatus is false" do
|
187 | 187 | it "should return running if a pid can be found" do
|
188 | 188 | provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => false))
|
189 |
| - expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) |
| 189 | + expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :combine => true, :failonfail => false, :override_locale => false, :priority => 0, :squelch => false) |
190 | 190 | expect(provider).to receive(:getpid).and_return(1000)
|
191 | 191 | expect(provider.status).to eq(:running)
|
192 | 192 | end
|
193 | 193 |
|
194 | 194 | it "should return stopped if no pid can be found" do
|
195 | 195 | provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => false))
|
196 |
| - expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) |
| 196 | + expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :combine => true, :failonfail => false, :override_locale => false, :priority => 0, :squelch => false) |
197 | 197 | expect(provider).to receive(:getpid).and_return(nil)
|
198 | 198 | expect(provider.status).to eq(:stopped)
|
199 | 199 | end
|
|
203 | 203 | it "should return running if <initscript> status exits with a zero exitcode" do
|
204 | 204 | provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => true))
|
205 | 205 | expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
|
206 |
| - expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) |
| 206 | + expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:status], :combine => true, :failonfail => false, :override_locale => false, :priority => 0, :squelch => false) |
207 | 207 | allow($CHILD_STATUS).to receive(:exitstatus).and_return(0)
|
208 | 208 | expect(provider.status).to eq(:running)
|
209 | 209 | end
|
210 | 210 |
|
211 | 211 | it "should return stopped if <initscript> status exits with a non-zero exitcode" do
|
212 | 212 | provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => true))
|
213 | 213 | expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
|
214 |
| - expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) |
| 214 | + expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:status], :combine => true, :failonfail => false, :override_locale => false, :priority => 0, :squelch => false) |
215 | 215 | allow($CHILD_STATUS).to receive(:exitstatus).and_return(3)
|
216 | 216 | expect(provider.status).to eq(:stopped)
|
217 | 217 | end
|
|
221 | 221 | describe "#restart" do
|
222 | 222 | it "should use the supplied restart command if specified" do
|
223 | 223 | provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :restart => '/bin/foo'))
|
224 |
| - expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:restart], :failonfail => true, :override_locale => false, :squelch => false, :combine => true) |
225 |
| - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true) |
| 224 | + expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:restart], :combine => true, :failonfail => true, :override_locale => false, :priority => 0, :squelch => false) |
| 225 | + expect(provider).to receive(:execute).with(['/bin/foo'], :combine => true, :failonfail => true, :override_locale => false, :priority => 0, :squelch => false) |
226 | 226 | provider.restart
|
227 | 227 | end
|
228 | 228 |
|
229 | 229 | it "should restart the service with <initscript> restart if hasrestart is true" do
|
230 | 230 | provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasrestart => true))
|
231 | 231 | expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
|
232 |
| - expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:restart], :failonfail => true, :override_locale => false, :squelch => false, :combine => true) |
| 232 | + expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:restart], :combine => true, :failonfail => true, :override_locale => false, :priority => 0, :squelch => false) |
233 | 233 | provider.restart
|
234 | 234 | end
|
235 | 235 |
|
236 | 236 | it "should restart the service with <initscript> stop/start if hasrestart is false" do
|
237 | 237 | provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasrestart => false))
|
238 | 238 | expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
|
239 |
| - expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:restart], :failonfail => true, :override_locale => false, :squelch => false, :combine => true) |
240 |
| - expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:stop], :failonfail => true, :override_locale => false, :squelch => false, :combine => true) |
241 |
| - expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:start], :failonfail => true, :override_locale => false, :squelch => false, :combine => true) |
| 239 | + expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:restart], :combine => true, :failonfail => true, :override_locale => false, :priority => 0, :squelch => false) |
| 240 | + expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:stop], :combine => true, :failonfail => true, :override_locale => false, :priority => 0, :squelch => false) |
| 241 | + expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:start], :combine => true, :failonfail => true, :override_locale => false, :priority => 0, :squelch => false) |
242 | 242 | provider.restart
|
243 | 243 | end
|
244 | 244 | end
|
|
0 commit comments