summaryrefslogtreecommitdiff
path: root/spec/functional
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-02-07 14:09:20 -0800
committerBryan McLellan <btm@opscode.com>2013-02-12 12:23:40 -0800
commitf4848fa1ac7bb61408e14f39315c0c53b54b87e9 (patch)
treed3fd5ab3480dc8242e68ea8dbb1bdd30e19323f2 /spec/functional
parentb97938bcf678644d0c30ce84f81c8d79c9bb112e (diff)
downloadchef-f4848fa1ac7bb61408e14f39315c0c53b54b87e9.tar.gz
fix race in test setup
the heart of the test is confirming that the last 2 messages are p1 releasing lock and then p2 acquiring it. The two messages confirm that the test case is set up correctly.
Diffstat (limited to 'spec/functional')
-rw-r--r--spec/functional/run_lock_spec.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/spec/functional/run_lock_spec.rb b/spec/functional/run_lock_spec.rb
index 10e99e72c5..d65e8a381e 100644
--- a/spec/functional/run_lock_spec.rb
+++ b/spec/functional/run_lock_spec.rb
@@ -114,6 +114,8 @@ describe Chef::RunLock do
# timeout reading from the sync pipe.
send_side_channel_error("Error syncing processes in run lock test (timeout)")
exit!(1)
+ else
+ sync_read.getc
end
end
@@ -184,9 +186,9 @@ describe Chef::RunLock do
wait_on_lock
p2 = fork do
+ record "p2 requesting lock"
# inform process p1 that we're trying to get the lock
sync_send
- record "p2 requesting lock"
run_lock.acquire
record "p2 has lock"
run_lock.release