summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-09-06 15:27:26 -0700
committerGitHub <noreply@github.com>2016-09-06 15:27:26 -0700
commit72bd53d19b09fbe702366267f674d16fd74253f3 (patch)
tree86924395fd6c9a38e26dd60cef99469323d7e336
parent02b6ca209f91b3d2777c476b650dc95aa3044c02 (diff)
parentb1ec7f48bfc4528446ec10dc9ff5552050f1798e (diff)
downloadchef-72bd53d19b09fbe702366267f674d16fd74253f3.tar.gz
Merge pull request #5279 from chef/lcg/fix-solo-spec-test
use threads to workaround Process.spawn buginess in chef-solo unit test
-rw-r--r--spec/integration/solo/solo_spec.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb
index efbbde2af9..bfcb74b45c 100644
--- a/spec/integration/solo/solo_spec.rb
+++ b/spec/integration/solo/solo_spec.rb
@@ -133,16 +133,21 @@ EOM
Timeout.timeout(120) do
chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..")
+ threads = []
+
# Instantiate the first chef-solo run
- s1 = Process.spawn("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' \
--l debug -L #{path_to('logs/runs.log')}", :chdir => chef_dir)
+ threads << Thread.new do
+ s1 = Process.spawn("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug -L #{path_to('logs/runs.log')}", :chdir => chef_dir)
+ Process.waitpid(s1)
+ end
# Instantiate the second chef-solo run
- s2 = Process.spawn("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' \
--l debug -L #{path_to('logs/runs.log')}", :chdir => chef_dir)
+ threads << Thread.new do
+ s2 = Process.spawn("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug -L #{path_to('logs/runs.log')}", :chdir => chef_dir)
+ Process.waitpid(s2)
+ end
- Process.waitpid(s1)
- Process.waitpid(s2)
+ threads.each(&:join)
end
end.not_to raise_error