From ff34a09183fdb7dd5a66d75ad90666394bdff55e Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 5 Mar 2020 13:33:39 -0800 Subject: 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 --- spec/functional/run_lock_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'spec/functional') 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 () -# 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) -- cgit v1.2.1