Skip to content

Commit 39aaa94

Browse files
authored
Merge pull request #8772 from joshcooper/main_pkg_exitstatus
(maint) Return ProcessOutput instead of using CHILD_STATUS
2 parents e579347 + a410e2f commit 39aaa94

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

spec/unit/provider/package/pkg_spec.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,16 +414,17 @@ def self.it_should_respond_to(*actions)
414414
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
415415
provider.insync?(is)
416416
end
417-
417+
418418
it "should try 5 times to install and fail when all tries failed" do
419419
allow_any_instance_of(Kernel).to receive(:sleep)
420-
420+
421421
expect(provider).to receive(:query).and_return({:ensure => :absent})
422422
expect(provider).to receive(:properties).and_return({:mark => :hold})
423423
expect(provider).to receive(:unhold)
424424
expect(Puppet::Util::Execution).to receive(:execute)
425-
.with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true}).exactly(5).times
426-
allow($CHILD_STATUS).to receive(:exitstatus).and_return(7)
425+
.with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true})
426+
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 7))
427+
.exactly(5).times
427428
expect {
428429
provider.update
429430
}.to raise_error(Puppet::Error, /Pkg could not install dummy after 5 tries. Aborting run/)

0 commit comments

Comments
 (0)