diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2020-03-05 13:33:39 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2020-03-05 13:33:39 -0800 |
commit | ff34a09183fdb7dd5a66d75ad90666394bdff55e (patch) | |
tree | 24427d0eb8c27e9c3072a997a78bc2527a16e4d9 /spec/functional | |
parent | 70279cd7b3221a5aa7a91965e463548cb5e2a507 (diff) | |
download | chef-ff34a09183fdb7dd5a66d75ad90666394bdff55e.tar.gz |
Fix file descriptor leak in our tests
Mac has a default max fd of 256 which this can pretty much blow out by
leaking PIPE objects which last until the garbage collector destroys
the instances, this forces the pipes to be closed when the stop function
is called here. Cuts down on over 200 leaking file descriptors from
this test which leak into the subsequent tests.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/functional')
-rw-r--r-- | spec/functional/run_lock_spec.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/spec/functional/run_lock_spec.rb b/spec/functional/run_lock_spec.rb index b6e192856b..f11fa5324c 100644 --- a/spec/functional/run_lock_spec.rb +++ b/spec/functional/run_lock_spec.rb @@ -1,6 +1,6 @@ # # Author:: Daniel DeLeo (<dan@chef.io>) -# Copyright:: Copyright 2012-2016, Chef Software, Inc. +# Copyright:: Copyright 2012-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -404,6 +404,10 @@ describe Chef::RunLock do example.log_event("#{name}.stop finished (pid #{pid} wasn't running)") end end + @read_from_process.close rescue nil + @write_to_tests.close rescue nil + @read_from_tests.close rescue nil + @write_to_process.close rescue nil end def fire_event(event) |