summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-09-02 09:46:03 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2016-09-02 09:46:03 -0700
commit2d1f789054e9c49ae205fc5792bd61fb2a09de70 (patch)
tree79bf21fff8ecc466a4acc812e2fcaddb735b6cc8
parent521437bad196d5403cf3b895b84a77dc7147572b (diff)
downloadchef-lcg/solo-test-loop-tweaking.tar.gz
tweak chef-solo run_lock timing testlcg/solo-test-loop-tweaking
- fix the 'last' statements (my perl brain occassionally crops up in ruby code) and replace with a raise. of course this just swaps one exception for another, but this time its really intended to work this way. - swap the order of the expecations so that if we fails to see the waiting on the other process statement, but we blow up in both threads in the exception that was just added, we know we actually have a legit run_lock race condition that this code just found. does not fix this bug, just gets us a bit more information if it reoccurs. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--spec/integration/solo/solo_spec.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb
index c4a7ca44ce..efbbde2af9 100644
--- a/spec/integration/solo/solo_spec.rb
+++ b/spec/integration/solo/solo_spec.rb
@@ -115,7 +115,7 @@ ruby_block "sleeping" do
retries = 200
while IO.read(Chef::Config[:log_location]) !~ /Chef client [0-9]+ is running, will wait for it to finish and then run./
sleep 0.1
- last if ( retries -= 1 ) <= 0
+ raise "we ran out of retries" if ( retries -= 1 ) <= 0
end
end
end
@@ -151,11 +151,11 @@ EOM
# checks in one example.
run_log = File.read(path_to("logs/runs.log"))
- # both of the runs should succeed
- expect(run_log.lines.reject { |l| !l.include? "INFO: Chef Run complete in" }.length).to eq(2)
-
# second run should have a message which indicates it's waiting for the first run
expect(run_log).to match(/Chef client [0-9]+ is running, will wait for it to finish and then run./)
+
+ # both of the runs should succeed
+ expect(run_log.lines.reject { |l| !l.include? "INFO: Chef Run complete in" }.length).to eq(2)
end
end