summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-08-18 14:50:44 -0700
committerGitHub <noreply@github.com>2016-08-18 14:50:44 -0700
commit44d6bcaa8cfdb10dbb7c7109001e7d49dc3e512b (patch)
treee4cbe15a944204c9df453cd261d00b4b66eddb72
parent3d06898012694791b0dc2faa742682b10f157532 (diff)
parent17fa671d988c27184d3ecef1d59b0bffe9791440 (diff)
downloadchef-44d6bcaa8cfdb10dbb7c7109001e7d49dc3e512b.tar.gz
Merge pull request #5222 from chef/lcg/solo-test-speedup
speed up solo test
-rw-r--r--spec/integration/solo/solo_spec.rb26
1 files changed, 6 insertions, 20 deletions
diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb
index 7daa87d2f0..c4a7ca44ce 100644
--- a/spec/integration/solo/solo_spec.rb
+++ b/spec/integration/solo/solo_spec.rb
@@ -112,7 +112,11 @@ EOM
file "cookbooks/x/recipes/default.rb", <<EOM
ruby_block "sleeping" do
block do
- sleep 10
+ 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
+ end
end
end
EOM
@@ -133,9 +137,6 @@ EOM
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)
- # Give it some time to progress
- sleep 5
-
# 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)
@@ -154,22 +155,7 @@ EOM
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
- pid_lines = run_log.lines.reject { |l| !l.include? "Chef-client pid:" }
- expect(pid_lines.length).to eq(2)
- pids = pid_lines.map { |l| l.split(" ").last }
- expect(run_log).to include("Chef client #{pids[0]} is running, will wait for it to finish and then run.")
-
- # second run should start after first run ends
- starts = [ ]
- ends = [ ]
- run_log.lines.each_with_index do |line, index|
- if line.include? "Chef-client pid:"
- starts << index
- elsif line.include? "INFO: Chef Run complete in"
- ends << index
- end
- end
- expect(starts[1]).to be > ends[0]
+ expect(run_log).to match(/Chef client [0-9]+ is running, will wait for it to finish and then run./)
end
end