diff options
Diffstat (limited to 'spec/integration/solo/solo_spec.rb')
-rw-r--r-- | spec/integration/solo/solo_spec.rb | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb index 63525f0081..58314473e7 100644 --- a/spec/integration/solo/solo_spec.rb +++ b/spec/integration/solo/solo_spec.rb @@ -23,10 +23,10 @@ describe "chef-solo" do let(:node_file) { Dir[File.join(nodes_dir, "*.json")][0] } before do - file "config/solo.rb", <<EOM -chef_repo_path "#{@repository_dir}" + file "config/solo.rb", <<~EOM + chef_repo_path "#{@repository_dir}" EOM - result = shell_out("ruby bin/chef-solo -c \"#{path_to('config/solo.rb')}\" -l debug", :cwd => chef_dir) + result = shell_out("ruby bin/chef-solo -c \"#{path_to('config/solo.rb')}\" -l debug", cwd: chef_dir) result.error! end @@ -74,26 +74,26 @@ EOM end it "should complete with success" do - file "config/solo.rb", <<EOM -cookbook_path "#{path_to('cookbooks')}" -file_cache_path "#{path_to('config/cache')}" + file "config/solo.rb", <<~EOM + cookbook_path "#{path_to('cookbooks')}" + file_cache_path "#{path_to('config/cache')}" EOM - result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir) + result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", cwd: chef_dir) result.error! expect(result.stdout).to include("ITWORKS") end it "should evaluate its node.json file" do - file "config/solo.rb", <<EOM -cookbook_path "#{path_to('cookbooks')}" -file_cache_path "#{path_to('config/cache')}" + file "config/solo.rb", <<~EOM + cookbook_path "#{path_to('cookbooks')}" + file_cache_path "#{path_to('config/cache')}" EOM - file "config/node.json", <<-E -{"run_list":["x::default"]} + file "config/node.json", <<~E + {"run_list":["x::default"]} E - result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -j '#{path_to('config/node.json')}' -l debug", :cwd => chef_dir) + result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -j '#{path_to('config/node.json')}' -l debug", cwd: chef_dir) result.error! expect(result.stdout).to include("ITWORKS") end @@ -110,11 +110,11 @@ E end it "should exit with an error" do - file "config/solo.rb", <<EOM -cookbook_path "#{path_to('cookbooks')}" -file_cache_path "#{path_to('config/cache')}" + file "config/solo.rb", <<~EOM + cookbook_path "#{path_to('cookbooks')}" + file_cache_path "#{path_to('config/cache')}" EOM - result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir) + result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", cwd: chef_dir) expect(result.exitstatus).to eq(0) # For CHEF-5120 this becomes 1 expect(result.stdout).to include("WARN: MissingCookbookDependency") end @@ -124,14 +124,14 @@ EOM before do file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0", "\nchef_version '~> 999.0'") file "cookbooks/x/recipes/default.rb", 'puts "ITWORKS"' - file "config/solo.rb", <<EOM -cookbook_path "#{path_to('cookbooks')}" -file_cache_path "#{path_to('config/cache')}" + file "config/solo.rb", <<~EOM + cookbook_path "#{path_to('cookbooks')}" + file_cache_path "#{path_to('config/cache')}" EOM end it "should exit with an error" do - result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir) + result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", cwd: chef_dir) expect(result.exitstatus).to eq(1) expect(result.stdout).to include("Chef::Exceptions::CookbookChefVersionMismatch") end @@ -141,14 +141,14 @@ EOM before do file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0", "\nohai_version '~> 999.0'") file "cookbooks/x/recipes/default.rb", 'puts "ITWORKS"' - file "config/solo.rb", <<EOM -cookbook_path "#{path_to('cookbooks')}" -file_cache_path "#{path_to('config/cache')}" + file "config/solo.rb", <<~EOM + cookbook_path "#{path_to('cookbooks')}" + file_cache_path "#{path_to('config/cache')}" EOM end it "should exit with an error" do - result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir) + result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", cwd: chef_dir) expect(result.exitstatus).to eq(1) expect(result.stdout).to include("Chef::Exceptions::CookbookOhaiVersionMismatch") end @@ -159,23 +159,23 @@ EOM directory "logs" file "logs/runs.log", "" file "cookbooks/x/metadata.rb", cookbook_x_100_metadata_rb - file "cookbooks/x/recipes/default.rb", <<EOM -ruby_block "sleeping" do - block do - retries = 200 - while IO.read(Chef::Config[:log_location]) !~ /Chef client .* is running, will wait for it to finish and then run./ - sleep 0.1 - raise "we ran out of retries" if ( retries -= 1 ) <= 0 - end - end -end + file "cookbooks/x/recipes/default.rb", <<~EOM + ruby_block "sleeping" do + block do + retries = 200 + while IO.read(Chef::Config[:log_location]) !~ /Chef client .* is running, will wait for it to finish and then run./ + sleep 0.1 + raise "we ran out of retries" if ( retries -= 1 ) <= 0 + end + end + end EOM end it "while running solo concurrently" do - file "config/solo.rb", <<EOM -cookbook_path "#{path_to('cookbooks')}" -file_cache_path "#{path_to('config/cache')}" + file "config/solo.rb", <<~EOM + cookbook_path "#{path_to('cookbooks')}" + file_cache_path "#{path_to('config/cache')}" EOM # We have a timeout protection here so that if due to some bug # run_lock gets stuck we can discover it. @@ -187,13 +187,13 @@ EOM # Instantiate the first chef-solo run 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) + 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 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) + 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 |