Skip to content

Commit

Permalink
Merge pull request #236 from dylanratcliffe/dev_null
Browse files Browse the repository at this point in the history
Added handling of bad execs
  • Loading branch information
Dylan authored Jun 19, 2019
2 parents 76cfa4a + 7b0957d commit 5688be1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions templates/test_spec.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ describe "<%= cls.name %>" do
end
<% end -%>

before :each do
# Curtrently there is some code within Puppet that will try to execute
# commands when compiling a catalog even though it shouldn't. One example is
# the groups attribute of the user resource on AIX. If we are running on
# Windows but pretending to be UNIX this will definitely fail so we need to
# mock it (or vice versa)
# Details:
# https://github.com/puppetlabs/puppet/blob/master/lib/puppet/util/execution.rb#L191
expected_null_file = Puppet::Util::Platform.windows? ? 'NUL' : '/dev/null'
unless File.exist? expected_null_file
Puppet::Util::Execution.stubs(:execute).raises(Puppet::ExecutionFailure.new("Onceover caused this"))
end
end

<% if @after_conditions -%>
after :each do
<% @after_conditions.each do |function| -%>
Expand Down

0 comments on commit 5688be1

Please sign in to comment.