summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-02-07 13:59:17 -0800
committerBryan McLellan <btm@opscode.com>2013-02-12 12:23:40 -0800
commitb97938bcf678644d0c30ce84f81c8d79c9bb112e (patch)
tree2da0eb942924227805ef59bd85c539a180b32fca
parent8fe042c21724651fd6e0e46b5f6e6d48cf86d053 (diff)
downloadchef-b97938bcf678644d0c30ce84f81c8d79c9bb112e.tar.gz
set sync=true on IPC in run lock tests
-rw-r--r--spec/functional/run_lock_spec.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/spec/functional/run_lock_spec.rb b/spec/functional/run_lock_spec.rb
index 26565116d5..10e99e72c5 100644
--- a/spec/functional/run_lock_spec.rb
+++ b/spec/functional/run_lock_spec.rb
@@ -51,7 +51,12 @@ describe Chef::RunLock do
# Side channel via a pipe allows child processes to send errors to the parent
# Don't lazy create the pipe or else we might not share it with subprocesses
- let!(:error_pipe) { IO.pipe }
+ let!(:error_pipe) do
+ r,w = IO.pipe
+ w.sync = true
+ [r,w]
+ end
+
let(:error_read) { error_pipe[0] }
let(:error_write) { error_pipe[1] }
@@ -89,7 +94,11 @@ describe Chef::RunLock do
# Interprocess synchronization via a pipe. This allows us to control the
# state of the processes competing over the lock without relying on sleep.
- let!(:sync_pipe) { IO.pipe }
+ let!(:sync_pipe) do
+ r,w = IO.pipe
+ w.sync = true
+ [r,w]
+ end
let(:sync_read) { sync_pipe[0] }
let(:sync_write) { sync_pipe[1] }
@@ -119,7 +128,11 @@ describe Chef::RunLock do
# IPC to record test results in a pipe. Tests can read pipe contents to
# check that operations occur in the expected order.
- let!(:results_pipe) { IO.pipe }
+ let!(:results_pipe) do
+ r,w = IO.pipe
+ w.sync = true
+ [r,w]
+ end
let(:results_read) { results_pipe[0] }
let(:results_write) { results_pipe[1] }