|
245 | 245 | context 'with a single item' do |
246 | 246 | it 'runs if the command exits non-zero' do |
247 | 247 | resource[param] = cmd_fail |
248 | | - expect(resource.check_all_attributes).to be(true) |
| 248 | + expect(resource.check_all_attributes).to be(false) |
249 | 249 | end |
250 | 250 |
|
251 | 251 | it 'does not run if the command exits zero' do |
252 | 252 | resource[param] = cmd_pass |
253 | | - expect(resource.check_all_attributes).to be(false) |
| 253 | + expect(resource.check_all_attributes).to be(true) |
254 | 254 | end |
255 | 255 | end |
256 | 256 |
|
257 | 257 | context 'with an array with a single item' do |
258 | 258 | it 'runs if the command exits non-zero' do |
259 | 259 | resource[param] = [cmd_fail] |
260 | | - expect(resource.check_all_attributes).to be(true) |
| 260 | + expect(resource.check_all_attributes).to be(false) |
261 | 261 | end |
262 | 262 |
|
263 | 263 | it 'does not run if the command exits zero' do |
264 | 264 | resource[param] = [cmd_pass] |
265 | | - expect(resource.check_all_attributes).to be(false) |
| 265 | + expect(resource.check_all_attributes).to be(true) |
266 | 266 | end |
267 | 267 | end |
268 | 268 |
|
269 | 269 | context 'with an array with multiple items' do |
270 | 270 | it 'runs if all the commands exits non-zero' do |
271 | 271 | resource[param] = [cmd_fail] * 3 |
272 | | - expect(resource.check_all_attributes).to be(true) |
| 272 | + expect(resource.check_all_attributes).to be(false) |
273 | 273 | end |
274 | 274 |
|
275 | 275 | it 'does not run if one command exits zero' do |
276 | 276 | resource[param] = [cmd_pass, cmd_fail, cmd_pass] |
277 | | - expect(resource.check_all_attributes).to be(false) |
| 277 | + expect(resource.check_all_attributes).to be(true) |
278 | 278 | end |
279 | 279 |
|
280 | 280 | it 'does not run if all command exits zero' do |
281 | 281 | resource[param] = [cmd_pass] * 3 |
282 | | - expect(resource.check_all_attributes).to be(false) |
| 282 | + expect(resource.check_all_attributes).to be(true) |
283 | 283 | end |
284 | 284 | end |
285 | 285 |
|
|
299 | 299 |
|
300 | 300 | it 'runs if all the commands exits non-zero' do |
301 | 301 | resource[param] = [[cmd_fail, '--flag'], [cmd_fail], [cmd_fail, '--flag']] |
302 | | - expect(resource.check_all_attributes).to be(true) |
| 302 | + expect(resource.check_all_attributes).to be(false) |
303 | 303 | end |
304 | 304 |
|
305 | 305 | it 'does not run if one command exits zero' do |
306 | 306 | resource[param] = [[cmd_pass, '--flag'], [cmd_pass], [cmd_fail, '--flag']] |
307 | | - expect(resource.check_all_attributes).to be(false) |
| 307 | + expect(resource.check_all_attributes).to be(true) |
308 | 308 | end |
309 | 309 |
|
310 | 310 | it 'does not run if all command exits zero' do |
311 | 311 | resource[param] = [[cmd_pass, '--flag'], [cmd_pass], [cmd_pass, '--flag']] |
312 | | - expect(resource.check_all_attributes).to be(false) |
| 312 | + expect(resource.check_all_attributes).to be(true) |
313 | 313 | end |
314 | 314 | end |
315 | 315 |
|
316 | 316 | it 'emits output to debug' do |
317 | 317 | Puppet::Util::Log.level = :debug |
318 | 318 | resource[param] = cmd_fail |
319 | | - expect(resource.check_all_attributes).to be(true) |
| 319 | + expect(resource.check_all_attributes).to be(false) |
320 | 320 | expect(@logs.shift.message).to eq('test output') |
321 | 321 | end |
322 | 322 |
|
323 | 323 | it 'does not emit output to debug if sensitive is true' do |
324 | 324 | Puppet::Util::Log.level = :debug |
325 | 325 | resource[param] = cmd_fail |
326 | 326 | allow(resource.parameters[param]).to receive(:sensitive).and_return(true) |
327 | | - expect(resource.check_all_attributes).to be(true) |
| 327 | + expect(resource.check_all_attributes).to be(false) |
328 | 328 | expect(@logs).not_to include(an_object_having_attributes(level: :debug, message: 'test output')) |
329 | 329 | expect(@logs).to include(an_object_having_attributes(level: :debug, message: '[output redacted]')) |
330 | 330 | end |
|
0 commit comments