diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2019-07-05 12:58:00 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2019-07-05 12:58:00 -0700 |
commit | 2a4916b7f01940d1199c35645c1b2172f5bd74b2 (patch) | |
tree | df7370ed682895857181f14bb66cad8db18b298e /spec/integration | |
parent | 8215091264d67d81f0da9a13f968b864ff736cb2 (diff) | |
download | chef-2a4916b7f01940d1199c35645c1b2172f5bd74b2.tar.gz |
Style/StringLiteralsInInterpolation
since we use double quotes, be consistent everywhere.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/integration')
-rw-r--r-- | spec/integration/client/client_spec.rb | 156 | ||||
-rw-r--r-- | spec/integration/client/exit_code_spec.rb | 4 | ||||
-rw-r--r-- | spec/integration/client/ipv6_spec.rb | 4 | ||||
-rw-r--r-- | spec/integration/knife/chef_fs_data_store_spec.rb | 50 | ||||
-rw-r--r-- | spec/integration/knife/chef_repo_path_spec.rb | 8 | ||||
-rw-r--r-- | spec/integration/knife/cookbook_api_ipv6_spec.rb | 2 | ||||
-rw-r--r-- | spec/integration/knife/diff_spec.rb | 4 | ||||
-rw-r--r-- | spec/integration/knife/download_spec.rb | 2 | ||||
-rw-r--r-- | spec/integration/knife/redirection_spec.rb | 2 | ||||
-rw-r--r-- | spec/integration/knife/upload_spec.rb | 4 | ||||
-rw-r--r-- | spec/integration/recipes/accumulator_spec.rb | 8 | ||||
-rw-r--r-- | spec/integration/recipes/lwrp_inline_resources_spec.rb | 4 | ||||
-rw-r--r-- | spec/integration/recipes/lwrp_spec.rb | 4 | ||||
-rw-r--r-- | spec/integration/recipes/notifies_spec.rb | 40 | ||||
-rw-r--r-- | spec/integration/recipes/notifying_block_spec.rb | 8 | ||||
-rw-r--r-- | spec/integration/recipes/remote_directory.rb | 4 | ||||
-rw-r--r-- | spec/integration/solo/solo_spec.rb | 40 |
17 files changed, 172 insertions, 172 deletions
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb index c2dc740025..7ae255eabf 100644 --- a/spec/integration/client/client_spec.rb +++ b/spec/integration/client/client_spec.rb @@ -55,19 +55,19 @@ describe "chef-client" do it "should complete with success" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM - shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) + shell_out!("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir) end it "should complete successfully with --no-listen" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM - result = shell_out("#{chef_client} --no-listen -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} --no-listen -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir) result.error! end @@ -108,10 +108,10 @@ describe "chef-client" do it "should complete with success" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir) result.error! end @@ -151,34 +151,34 @@ describe "chef-client" do it "should complete with success even with a client key" do file "config/client.rb", <<~EOM local_mode true - client_key #{path_to('mykey.pem').inspect} - cookbook_path #{path_to('cookbooks').inspect} + client_key #{path_to("mykey.pem").inspect} + cookbook_path #{path_to("cookbooks").inspect} EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir) result.error! end it "should run recipes specified directly on the command line" do file "config/client.rb", <<~EOM local_mode true - client_key #{path_to('mykey.pem').inspect} - cookbook_path #{path_to('cookbooks').inspect} + client_key #{path_to("mykey.pem").inspect} + cookbook_path #{path_to("cookbooks").inspect} EOM file "arbitrary.rb", <<~EOM - file #{path_to('tempfile.txt').inspect} do + file #{path_to("tempfile.txt").inspect} do content '1' end EOM file "arbitrary2.rb", <<~EOM - file #{path_to('tempfile2.txt').inspect} do + file #{path_to("tempfile2.txt").inspect} do content '2' end EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" #{path_to('arbitrary.rb')} #{path_to('arbitrary2.rb')}", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" #{path_to("arbitrary.rb")} #{path_to("arbitrary2.rb")}", cwd: chef_dir) result.error! expect(IO.read(path_to("tempfile.txt"))).to eq("1") @@ -188,17 +188,17 @@ describe "chef-client" do it "should run recipes specified as relative paths directly on the command line" do file "config/client.rb", <<~EOM local_mode true - client_key #{path_to('mykey.pem').inspect} - cookbook_path #{path_to('cookbooks').inspect} + client_key #{path_to("mykey.pem").inspect} + cookbook_path #{path_to("cookbooks").inspect} EOM file "arbitrary.rb", <<~EOM - file #{path_to('tempfile.txt').inspect} do + file #{path_to("tempfile.txt").inspect} do content '1' end EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" arbitrary.rb", cwd: path_to("")) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" arbitrary.rb", cwd: path_to("")) result.error! expect(IO.read(path_to("tempfile.txt"))).to eq("1") @@ -207,8 +207,8 @@ describe "chef-client" do it "should run recipes specified directly on the command line AFTER recipes in the run list" do file "config/client.rb", <<~EOM local_mode true - client_key #{path_to('mykey.pem').inspect} - cookbook_path #{path_to('cookbooks').inspect} + client_key #{path_to("mykey.pem").inspect} + cookbook_path #{path_to("cookbooks").inspect} EOM file "cookbooks/x/recipes/constant_definition.rb", <<~EOM @@ -218,12 +218,12 @@ describe "chef-client" do EOM file "arbitrary.rb", <<~EOM - file #{path_to('tempfile.txt').inspect} do + file #{path_to("tempfile.txt").inspect} do content ::Blah::THECONSTANT end EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o x::constant_definition arbitrary.rb", cwd: path_to("")) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o x::constant_definition arbitrary.rb", cwd: path_to("")) result.error! expect(IO.read(path_to("tempfile.txt"))).to eq("1") @@ -232,8 +232,8 @@ describe "chef-client" do it "should run recipes specified directly on the command line AFTER recipes in the run list (without an override_runlist this time)" do file "config/client.rb", <<~EOM local_mode true - client_key #{path_to('mykey.pem').inspect} - cookbook_path #{path_to('cookbooks').inspect} + client_key #{path_to("mykey.pem").inspect} + cookbook_path #{path_to("cookbooks").inspect} EOM file "config/dna.json", <<~EOM @@ -249,12 +249,12 @@ describe "chef-client" do EOM file "arbitrary.rb", <<~EOM - file #{path_to('tempfile.txt').inspect} do + file #{path_to("tempfile.txt").inspect} do content ::Blah::THECONSTANT end EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -j \"#{path_to('config/dna.json')}\" arbitrary.rb", cwd: path_to("")) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -j \"#{path_to("config/dna.json")}\" arbitrary.rb", cwd: path_to("")) result.error! expect(IO.read(path_to("tempfile.txt"))).to eq("1") @@ -263,8 +263,8 @@ describe "chef-client" do it "an override_runlist of an empty string should allow a recipe specified directly on the command line to be the only one run" do file "config/client.rb", <<~EOM local_mode true - client_key #{path_to('mykey.pem').inspect} - cookbook_path #{path_to('cookbooks').inspect} + client_key #{path_to("mykey.pem").inspect} + cookbook_path #{path_to("cookbooks").inspect} class ::Blah THECONSTANT = "1" end @@ -284,12 +284,12 @@ describe "chef-client" do file "arbitrary.rb", <<~EOM raise "this test failed" unless ::Blah::THECONSTANT == "1" - file #{path_to('tempfile.txt').inspect} do + file #{path_to("tempfile.txt").inspect} do content ::Blah::THECONSTANT end EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -j \"#{path_to('config/dna.json')}\" -o \"\" arbitrary.rb", cwd: path_to("")) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -j \"#{path_to("config/dna.json")}\" -o \"\" arbitrary.rb", cwd: path_to("")) result.error! expect(IO.read(path_to("tempfile.txt"))).to eq("1") @@ -300,30 +300,30 @@ describe "chef-client" do it "should complete with success when passed the -z flag" do file "config/client.rb", <<~EOM chef_server_url 'http://omg.com/blah' - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' -z", cwd: chef_dir) result.error! end it "should complete with success when passed the --local-mode flag" do file "config/client.rb", <<~EOM chef_server_url 'http://omg.com/blah' - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --local-mode", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --local-mode", cwd: chef_dir) result.error! end it "should not print SSL warnings when running in local-mode" do file "config/client.rb", <<~EOM chef_server_url 'http://omg.com/blah' - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --local-mode", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --local-mode", cwd: chef_dir) expect(result.stdout).not_to include("SSL validation of HTTPS requests is disabled.") result.error! end @@ -331,20 +331,20 @@ describe "chef-client" do it "should complete with success when passed -z and --chef-zero-port" do file "config/client.rb", <<~EOM chef_server_url 'http://omg.com/blah' - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' -z", cwd: chef_dir) result.error! end it "should complete with success when setting the run list with -r" do file "config/client.rb", <<~EOM chef_server_url 'http://omg.com/blah' - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -r 'x::default' -z -l info", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -r 'x::default' -z -l info", cwd: chef_dir) expect(result.stdout).not_to include("Overridden Run List") expect(result.stdout).to include("Run List is [recipe[x::default]]") result.error! @@ -353,9 +353,9 @@ describe "chef-client" do it "should complete with success when using --profile-ruby and output a profile file", :not_supported_on_aix do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM - result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z --profile-ruby", cwd: chef_dir) + result = shell_out!("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' -z --profile-ruby", cwd: chef_dir) result.error! expect(File.exist?(path_to("config/local-mode-cache/cache/graph_profile.out"))).to be true end @@ -363,9 +363,9 @@ describe "chef-client" do it "doesn't produce a profile when --profile-ruby is not present" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM - result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", cwd: chef_dir) + result = shell_out!("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' -z", cwd: chef_dir) result.error! expect(File.exist?(path_to("config/local-mode-cache/cache/graph_profile.out"))).to be false end @@ -381,11 +381,11 @@ describe "chef-client" do EOM file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM end it "should fail the chef client run" do - command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir) + command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir) expect(command.exitstatus).to eql(1) expect(command.stdout).to match(/Chef::Exceptions::CookbookChefVersionMismatch/) end @@ -406,12 +406,12 @@ describe "chef-client" do EOM file "config/client.rb", <<-EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM end it "the cheffish DSL is loaded lazily" do - command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir) + command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir) expect(command.exitstatus).to eql(0) end end @@ -437,7 +437,7 @@ describe "chef-client" do it "should output each deprecation warning only once, at the end of the run" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" # Mimick what happens when you are on the console formatters << :doc log_level :warn @@ -445,7 +445,7 @@ describe "chef-client" do ENV.delete("CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS") - result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) + result = shell_out!("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir) expect(result.error?).to be_falsey # Search to the end of the client run in the output @@ -460,7 +460,7 @@ describe "chef-client" do when_the_repository "has a cookbook that deploys a file" do before do file "cookbooks/x/recipes/default.rb", <<~RECIPE - cookbook_file #{path_to('tempfile.txt').inspect} do + cookbook_file #{path_to("tempfile.txt").inspect} do source "my_file" end RECIPE @@ -476,9 +476,9 @@ describe "chef-client" do file "config/client.rb", <<~EOM no_lazy_load #{lazy} local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM - result = shell_out("#{chef_client} -l debug -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir) + result = shell_out("#{chef_client} -l debug -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir) result.error! expect(IO.read(path_to("tempfile.txt")).strip).to eq("this is my file") @@ -490,7 +490,7 @@ describe "chef-client" do when_the_repository "has a cookbook with an ohai plugin" do before do file "cookbooks/x/recipes/default.rb", <<~RECIPE - file #{path_to('tempfile.txt').inspect} do + file #{path_to("tempfile.txt").inspect} do content node["english"]["version"] end RECIPE @@ -508,12 +508,12 @@ describe "chef-client" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM end it "should run the ohai plugin" do - result = shell_out("#{chef_client} -l debug -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir) + result = shell_out("#{chef_client} -l debug -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir) result.error! expect(IO.read(path_to("tempfile.txt"))).to eq("2014") @@ -536,7 +536,7 @@ describe "chef-client" do file "config/client.rb", <<~EOM chef_repo_path "#{tmp_dir}" EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --recipe-url=http://localhost:9000/recipes.tgz -o 'x::default' -z", cwd: tmp_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --recipe-url=http://localhost:9000/recipes.tgz -o 'x::default' -z", cwd: tmp_dir) result.error! end @@ -569,17 +569,17 @@ describe "chef-client" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM end it "the chef client run should succeed" do - command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir) + command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir) command.error! end it "a chef-solo run should succeed" do - command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir) + command = shell_out("#{chef_solo} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir) command.error! end end @@ -593,30 +593,30 @@ describe "chef-client" do EOM file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM end it "a chef client run should not log to info by default" do - command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir) + command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir) command.error! expect(command.stdout).not_to include("INFO") end it "a chef client run to a pipe should not log to info by default" do - command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork | tee #{path_to('chefrun.out')}", cwd: chef_dir) + command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork | tee #{path_to("chefrun.out")}", cwd: chef_dir) command.error! expect(command.stdout).not_to include("INFO") end it "a chef solo run should not log to info by default" do - command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir) + command = shell_out("#{chef_solo} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir) command.error! expect(command.stdout).not_to include("INFO") end it "a chef solo run to a pipe should not log to info by default" do - command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork | tee #{path_to('chefrun.out')}", cwd: chef_dir) + command = shell_out("#{chef_solo} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork | tee #{path_to("chefrun.out")}", cwd: chef_dir) command.error! expect(command.stdout).not_to include("INFO") end @@ -629,42 +629,42 @@ EOM EOM file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM end it "chef-client runs by default with no supervisor" do - command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) + command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir) command.error! expect(command.stdout).to include("NOFORK") end it "chef-solo runs by default with no supervisor" do - command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) + command = shell_out("#{chef_solo} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir) command.error! expect(command.stdout).to include("NOFORK") end it "chef-client --no-fork does not fork" do - command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir) + command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir) command.error! expect(command.stdout).to include("NOFORK") end it "chef-solo --no-fork does not fork" do - command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir) + command = shell_out("#{chef_solo} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --no-fork", cwd: chef_dir) command.error! expect(command.stdout).to include("NOFORK") end it "chef-client with --fork uses a supervisor" do - command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --fork", cwd: chef_dir) + command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --fork", cwd: chef_dir) command.error! expect(command.stdout).to include("WITHFORK") end it "chef-solo with --fork uses a supervisor" do - command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --fork", cwd: chef_dir) + command = shell_out("#{chef_solo} -c \"#{path_to("config/client.rb")}\" -o 'x::default' --fork", cwd: chef_dir) command.error! expect(command.stdout).to include("WITHFORK") end @@ -677,19 +677,19 @@ EOM EOM file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" client_fork true EOM end it "chef-client uses a supervisor" do - command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) + command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir) command.error! expect(command.stdout).to include("WITHFORK") end it "chef-solo uses a supervisor" do - command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) + command = shell_out("#{chef_solo} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir) command.error! expect(command.stdout).to include("WITHFORK") end @@ -702,19 +702,19 @@ EOM EOM file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" client_fork false EOM end it "chef-client uses a supervisor" do - command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) + command = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir) command.error! expect(command.stdout).to include("NOFORK") end it "chef-solo uses a supervisor" do - command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) + command = shell_out("#{chef_solo} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir) command.error! expect(command.stdout).to include("NOFORK") end diff --git a/spec/integration/client/exit_code_spec.rb b/spec/integration/client/exit_code_spec.rb index ff48d69527..37999ab431 100644 --- a/spec/integration/client/exit_code_spec.rb +++ b/spec/integration/client/exit_code_spec.rb @@ -30,12 +30,12 @@ describe "chef-client" do def setup_client_rb file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM end def run_chef_client_and_expect_exit_code(exit_code) - shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", + shell_out!("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'x::default'", cwd: chef_dir, returns: [exit_code]) end diff --git a/spec/integration/client/ipv6_spec.rb b/spec/integration/client/ipv6_spec.rb index b97eb4e8b4..2d16786334 100644 --- a/spec/integration/client/ipv6_spec.rb +++ b/spec/integration/client/ipv6_spec.rb @@ -63,7 +63,7 @@ describe "chef-client" do let(:basic_config_file) do <<~END_CLIENT_RB chef_server_url "http://[::1]:8900" - validation_key '#{path_to('config/validator.pem')}' + validation_key '#{path_to("config/validator.pem")}' cache_path '#{cache_path}' client_key '#{cache_path}/client.pem' END_CLIENT_RB @@ -75,7 +75,7 @@ describe "chef-client" do let(:chef_dir) { File.join(File.dirname(__FILE__), "..", "..", "..", "bin") } - let(:chef_client_cmd) { %Q{bundle exec chef-client --minimal-ohai -c "#{path_to('config/client.rb')}" -lwarn} } + let(:chef_client_cmd) { %Q{bundle exec chef-client --minimal-ohai -c "#{path_to("config/client.rb")}" -lwarn} } after do FileUtils.rm_rf(cache_path) diff --git a/spec/integration/knife/chef_fs_data_store_spec.rb b/spec/integration/knife/chef_fs_data_store_spec.rb index abd4f129a1..58ca5121c5 100644 --- a/spec/integration/knife/chef_fs_data_store_spec.rb +++ b/spec/integration/knife/chef_fs_data_store_spec.rb @@ -185,12 +185,12 @@ describe "ChefFSDataStore tests", :workstation do end it "knife raw -z -i empty.json -m PUT /clients/x" do - knife("raw -z -i #{path_to('empty.json')} -m PUT /clients/x").should_succeed( /"x"/ ) + knife("raw -z -i #{path_to("empty.json")} -m PUT /clients/x").should_succeed( /"x"/ ) knife("list --local /clients").should_succeed "/clients/x.json\n" end it "knife cookbook upload works" do - knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} x").should_succeed stderr: <<~EOM + knife("cookbook upload -z --cookbook-path #{path_to("cookbooks_to_upload")} x").should_succeed stderr: <<~EOM Uploading x [1.0.0] Uploaded 1 cookbook. EOM @@ -198,28 +198,28 @@ describe "ChefFSDataStore tests", :workstation do end it "knife raw -z -i empty.json -m PUT /data/x/y" do - knife("raw -z -i #{path_to('empty.json')} -m PUT /data/x/y").should_succeed( /"y"/ ) + knife("raw -z -i #{path_to("empty.json")} -m PUT /data/x/y").should_succeed( /"y"/ ) knife("list --local -Rfp /data_bags").should_succeed "/data_bags/x/\n/data_bags/x/y.json\n" end it "knife raw -z -i empty.json -m PUT /environments/x" do - knife("raw -z -i #{path_to('empty.json')} -m PUT /environments/x").should_succeed( /"x"/ ) + knife("raw -z -i #{path_to("empty.json")} -m PUT /environments/x").should_succeed( /"x"/ ) knife("list --local /environments").should_succeed "/environments/x.json\n" end it "knife raw -z -i dummynode.json -m PUT /nodes/x" do - knife("raw -z -i #{path_to('dummynode.json')} -m PUT /nodes/x").should_succeed( /"x"/ ) + knife("raw -z -i #{path_to("dummynode.json")} -m PUT /nodes/x").should_succeed( /"x"/ ) knife("list --local /nodes").should_succeed "/nodes/x.json\n" knife("show -z /nodes/x.json --verbose").should_succeed(/"bar"/) end it "knife raw -z -i empty.json -m PUT /roles/x" do - knife("raw -z -i #{path_to('empty.json')} -m PUT /roles/x").should_succeed( /"x"/ ) + knife("raw -z -i #{path_to("empty.json")} -m PUT /roles/x").should_succeed( /"x"/ ) knife("list --local /roles").should_succeed "/roles/x.json\n" end it "After knife raw -z -i rolestuff.json -m PUT /roles/x, the output is pretty" do - knife("raw -z -i #{path_to('rolestuff.json')} -m PUT /roles/x").should_succeed( /"x"/ ) + knife("raw -z -i #{path_to("rolestuff.json")} -m PUT /roles/x").should_succeed( /"x"/ ) expect(IO.read(path_to("roles/x.json"))).to eq <<~EOM.strip { "name": "x", @@ -242,12 +242,12 @@ describe "ChefFSDataStore tests", :workstation do end it "knife raw -z -i empty.json -m POST /clients" do - knife("raw -z -i #{path_to('empty.json')} -m POST /clients").should_succeed( /uri/ ) + knife("raw -z -i #{path_to("empty.json")} -m POST /clients").should_succeed( /uri/ ) knife("list --local /clients").should_succeed "/clients/z.json\n" end it "knife cookbook upload works" do - knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} z").should_succeed stderr: <<~EOM + knife("cookbook upload -z --cookbook-path #{path_to("cookbooks_to_upload")} z").should_succeed stderr: <<~EOM Uploading z [1.0.0] Uploaded 1 cookbook. EOM @@ -255,34 +255,34 @@ describe "ChefFSDataStore tests", :workstation do end it "knife raw -z -i empty.json -m POST /data" do - knife("raw -z -i #{path_to('empty.json')} -m POST /data").should_succeed( /uri/ ) + knife("raw -z -i #{path_to("empty.json")} -m POST /data").should_succeed( /uri/ ) knife("list --local -Rfp /data_bags").should_succeed "/data_bags/z/\n" end it "knife raw -z -i empty.json -m POST /data/x" do - knife("raw -z -i #{path_to('empty_x.json')} -m POST /data").should_succeed( /uri/ ) - knife("raw -z -i #{path_to('empty_id.json')} -m POST /data/x").should_succeed( /"z"/ ) + knife("raw -z -i #{path_to("empty_x.json")} -m POST /data").should_succeed( /uri/ ) + knife("raw -z -i #{path_to("empty_id.json")} -m POST /data/x").should_succeed( /"z"/ ) knife("list --local -Rfp /data_bags").should_succeed "/data_bags/x/\n/data_bags/x/z.json\n" end it "knife raw -z -i empty.json -m POST /environments" do - knife("raw -z -i #{path_to('empty.json')} -m POST /environments").should_succeed( /uri/ ) + knife("raw -z -i #{path_to("empty.json")} -m POST /environments").should_succeed( /uri/ ) knife("list --local /environments").should_succeed "/environments/z.json\n" end it "knife raw -z -i dummynode.json -m POST /nodes" do - knife("raw -z -i #{path_to('dummynode.json')} -m POST /nodes").should_succeed( /uri/ ) + knife("raw -z -i #{path_to("dummynode.json")} -m POST /nodes").should_succeed( /uri/ ) knife("list --local /nodes").should_succeed "/nodes/z.json\n" knife("show -z /nodes/z.json").should_succeed(/"bar"/) end it "knife raw -z -i empty.json -m POST /roles" do - knife("raw -z -i #{path_to('empty.json')} -m POST /roles").should_succeed( /uri/ ) + knife("raw -z -i #{path_to("empty.json")} -m POST /roles").should_succeed( /uri/ ) knife("list --local /roles").should_succeed "/roles/z.json\n" end it "After knife raw -z -i rolestuff.json -m POST /roles, the output is pretty" do - knife("raw -z -i #{path_to('rolestuff.json')} -m POST /roles").should_succeed( /uri/ ) + knife("raw -z -i #{path_to("rolestuff.json")} -m POST /roles").should_succeed( /uri/ ) expect(IO.read(path_to("roles/x.json"))).to eq <<~EOM.strip { "name": "x", @@ -388,23 +388,23 @@ describe "ChefFSDataStore tests", :workstation do end it "knife raw -z -i empty.json -m PUT /clients/x fails with 404" do - knife("raw -z -i #{path_to('empty.json')} -m PUT /clients/x").should_fail( /404/ ) + knife("raw -z -i #{path_to("empty.json")} -m PUT /clients/x").should_fail( /404/ ) end it "knife raw -z -i empty.json -m PUT /data/x/y fails with 404" do - knife("raw -z -i #{path_to('empty.json')} -m PUT /data/x/y").should_fail( /404/ ) + knife("raw -z -i #{path_to("empty.json")} -m PUT /data/x/y").should_fail( /404/ ) end it "knife raw -z -i empty.json -m PUT /environments/x fails with 404" do - knife("raw -z -i #{path_to('empty.json')} -m PUT /environments/x").should_fail( /404/ ) + knife("raw -z -i #{path_to("empty.json")} -m PUT /environments/x").should_fail( /404/ ) end it "knife raw -z -i empty.json -m PUT /nodes/x fails with 404" do - knife("raw -z -i #{path_to('empty.json')} -m PUT /nodes/x").should_fail( /404/ ) + knife("raw -z -i #{path_to("empty.json")} -m PUT /nodes/x").should_fail( /404/ ) end it "knife raw -z -i empty.json -m PUT /roles/x fails with 404" do - knife("raw -z -i #{path_to('empty.json')} -m PUT /roles/x").should_fail( /404/ ) + knife("raw -z -i #{path_to("empty.json")} -m PUT /roles/x").should_fail( /404/ ) end end @@ -485,12 +485,12 @@ describe "ChefFSDataStore tests", :workstation do end it "knife raw -z -i empty.json -m PUT /users/x" do - knife("raw -z -i #{path_to('empty.json')} -m PUT /users/x").should_succeed( /"x"/ ) + knife("raw -z -i #{path_to("empty.json")} -m PUT /users/x").should_succeed( /"x"/ ) knife("list --local /users").should_succeed "/users/x.json\n" end it "After knife raw -z -i rolestuff.json -m PUT /roles/x, the output is pretty" do - knife("raw -z -i #{path_to('rolestuff.json')} -m PUT /roles/x").should_succeed( /"x"/ ) + knife("raw -z -i #{path_to("rolestuff.json")} -m PUT /roles/x").should_succeed( /"x"/ ) expect(IO.read(path_to("roles/x.json"))).to eq <<~EOM.strip { "name": "x", @@ -513,7 +513,7 @@ describe "ChefFSDataStore tests", :workstation do end it "knife raw -z -i empty.json -m POST /users" do - knife("raw -z -i #{path_to('empty.json')} -m POST /users").should_succeed( /uri/ ) + knife("raw -z -i #{path_to("empty.json")} -m POST /users").should_succeed( /uri/ ) knife("list --local /users").should_succeed "/users/z.json\n" end end @@ -548,7 +548,7 @@ describe "ChefFSDataStore tests", :workstation do end it "knife raw -z -i empty.json -m PUT /users/x fails with 404" do - knife("raw -z -i #{path_to('empty.json')} -m PUT /users/x").should_fail( /404/ ) + knife("raw -z -i #{path_to("empty.json")} -m PUT /users/x").should_fail( /404/ ) end end end diff --git a/spec/integration/knife/chef_repo_path_spec.rb b/spec/integration/knife/chef_repo_path_spec.rb index 4a133b0181..919741f930 100644 --- a/spec/integration/knife/chef_repo_path_spec.rb +++ b/spec/integration/knife/chef_repo_path_spec.rb @@ -59,7 +59,7 @@ describe "chef_repo_path tests", :workstation do it "knife list --local -Rfp --chef-repo-path chef_repo2 / grabs chef_repo2 stuff" do Chef::Config.delete(:chef_repo_path) - knife("list --local -Rfp --chef-repo-path #{path_to('chef_repo2')} /").should_succeed <<~EOM + knife("list --local -Rfp --chef-repo-path #{path_to("chef_repo2")} /").should_succeed <<~EOM /clients/ /clients/client3.json /cookbooks/ @@ -81,7 +81,7 @@ describe "chef_repo_path tests", :workstation do it "knife list --local -Rfp --chef-repo-path chef_r~1 / grabs chef_repo2 stuff", :windows_only do Chef::Config.delete(:chef_repo_path) - knife("list --local -Rfp --chef-repo-path #{path_to('chef_r~1')} /").should_succeed <<~EOM + knife("list --local -Rfp --chef-repo-path #{path_to("chef_r~1")} /").should_succeed <<~EOM /clients/ /clients/client3.json /cookbooks/ @@ -103,7 +103,7 @@ describe "chef_repo_path tests", :workstation do it "knife list --local -Rfp --chef-repo-path chef_r~1 / grabs chef_repo2 stuff", :windows_only do Chef::Config.delete(:chef_repo_path) - knife("list -z -Rfp --chef-repo-path #{path_to('chef_r~1')} /").should_succeed <<~EOM + knife("list -z -Rfp --chef-repo-path #{path_to("chef_r~1")} /").should_succeed <<~EOM /acls/ /acls/clients/ /acls/clients/client3.json @@ -157,7 +157,7 @@ describe "chef_repo_path tests", :workstation do end it "knife list --local -Rfp --chef-repo-path chef_repo2 / grabs chef_repo2 stuff" do - knife("list --local -Rfp --chef-repo-path #{path_to('chef_repo2')} /").should_succeed <<~EOM + knife("list --local -Rfp --chef-repo-path #{path_to("chef_repo2")} /").should_succeed <<~EOM /clients/ /clients/client3.json /cookbooks/ diff --git a/spec/integration/knife/cookbook_api_ipv6_spec.rb b/spec/integration/knife/cookbook_api_ipv6_spec.rb index a7e3709276..c615d8de7a 100644 --- a/spec/integration/knife/cookbook_api_ipv6_spec.rb +++ b/spec/integration/knife/cookbook_api_ipv6_spec.rb @@ -77,7 +77,7 @@ describe "Knife cookbook API integration with IPv6", :workstation, :not_supporte <<~END_CLIENT_RB chef_server_url "http://[::1]:8900" syntax_check_cache_path '#{cache_path}' - client_key '#{path_to('config/knifeuser.pem')}' + client_key '#{path_to("config/knifeuser.pem")}' node_name 'whoisthisis' cookbook_path '#{CHEF_SPEC_DATA}/cookbooks' END_CLIENT_RB diff --git a/spec/integration/knife/diff_spec.rb b/spec/integration/knife/diff_spec.rb index cd08ebdcbd..87cbd1559d 100644 --- a/spec/integration/knife/diff_spec.rb +++ b/spec/integration/knife/diff_spec.rb @@ -309,7 +309,7 @@ describe "knife diff", :workstation do when_the_repository "has an environment with bad JSON" do before { file "environments/x.json", "{" } it "knife diff reports an error and does a textual diff" do - error_text = "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF" + error_text = "WARN: Parse error reading #{path_to("environments/x.json")} as JSON: parse error: premature EOF" error_match = Regexp.new(Regexp.escape(error_text)) knife("diff /environments/x.json").should_succeed(/- "name": "x"/, stderr: error_match) end @@ -592,7 +592,7 @@ describe "knife diff", :workstation do when_the_repository "has an environment with bad JSON" do before { file "environments/x.json", "{" } it "knife diff reports an error and does a textual diff" do - error_text = "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF" + error_text = "WARN: Parse error reading #{path_to("environments/x.json")} as JSON: parse error: premature EOF" error_match = Regexp.new(Regexp.escape(error_text)) knife("diff /environments/x.json").should_succeed(/- "name": "x"/, stderr: error_match) end diff --git a/spec/integration/knife/download_spec.rb b/spec/integration/knife/download_spec.rb index 93d804b749..77f6d3890e 100644 --- a/spec/integration/knife/download_spec.rb +++ b/spec/integration/knife/download_spec.rb @@ -561,7 +561,7 @@ describe "knife download", :workstation do end it "knife download succeeds" do warning = <<~EOH - WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF + WARN: Parse error reading #{path_to("environments/x.json")} as JSON: parse error: premature EOF { (right here) ------^ diff --git a/spec/integration/knife/redirection_spec.rb b/spec/integration/knife/redirection_spec.rb index d387b10e3b..5e5ef27b9a 100644 --- a/spec/integration/knife/redirection_spec.rb +++ b/spec/integration/knife/redirection_spec.rb @@ -34,7 +34,7 @@ describe "redirection", :workstation do real_chef_server_url = Chef::Config.chef_server_url Chef::Config.chef_server_url = "http://localhost:9018" app = lambda do |env| - [302, { "Content-Type" => "text", "Location" => "#{real_chef_server_url}#{env['PATH_INFO']}" }, ["302 found"] ] + [302, { "Content-Type" => "text", "Location" => "#{real_chef_server_url}#{env["PATH_INFO"]}" }, ["302 found"] ] end @redirector_server_thread = start_app_server(app, 9018) end diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb index 766f91ab25..1a6ddceb17 100644 --- a/spec/integration/knife/upload_spec.rb +++ b/spec/integration/knife/upload_spec.rb @@ -636,7 +636,7 @@ EOM it "knife upload tries and fails" do error1 = <<~EOH - WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF + WARN: Parse error reading #{path_to("environments/x.json")} as JSON: parse error: premature EOF { (right here) ------^ @@ -646,7 +646,7 @@ EOM EOH warn = <<~EOH - WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF + WARN: Parse error reading #{path_to("environments/x.json")} as JSON: parse error: premature EOF { (right here) ------^ diff --git a/spec/integration/recipes/accumulator_spec.rb b/spec/integration/recipes/accumulator_spec.rb index d19d8637bb..98e3581071 100644 --- a/spec/integration/recipes/accumulator_spec.rb +++ b/spec/integration/recipes/accumulator_spec.rb @@ -115,11 +115,11 @@ describe "Accumulators" do it "should complete with success" do file "config/client.rb", <<-EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" log_level :warn EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) result.error! # runs only a single template resource (in the outer run context, as a delayed resource) expect(result.stdout.scan(/template\S+ action create/).size).to eql(1) @@ -217,11 +217,11 @@ describe "Accumulators" do it "should complete with success" do file "config/client.rb", <<-EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" log_level :warn EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) result.error! # runs only a single template resource (in the outer run context, as a delayed resource) expect(result.stdout.scan(/template\S+ action create/).size).to eql(1) diff --git a/spec/integration/recipes/lwrp_inline_resources_spec.rb b/spec/integration/recipes/lwrp_inline_resources_spec.rb index d978a18e3e..75516203b3 100644 --- a/spec/integration/recipes/lwrp_inline_resources_spec.rb +++ b/spec/integration/recipes/lwrp_inline_resources_spec.rb @@ -147,11 +147,11 @@ describe "LWRPs with inline resources" do it "should complete with success" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" log_level :warn EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) actual = result.stdout.lines.map { |l| l.chomp }.join("\n") expected = <<EOM * x_my_machine[me] action create diff --git a/spec/integration/recipes/lwrp_spec.rb b/spec/integration/recipes/lwrp_spec.rb index ce2861d43b..957c1ea66f 100644 --- a/spec/integration/recipes/lwrp_spec.rb +++ b/spec/integration/recipes/lwrp_spec.rb @@ -40,11 +40,11 @@ describe "LWRPs" do it "should complete with success" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" log_level :warn EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'l-w-r-p::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'l-w-r-p::default'", cwd: chef_dir) expect(result.stdout).to match(/\* l_w_r_p_foo\[me\] action create \(up to date\)/) expect(result.stdout).not_to match(/WARN: You are overriding l_w_r_p_foo/) result.error! diff --git a/spec/integration/recipes/notifies_spec.rb b/spec/integration/recipes/notifies_spec.rb index 860a109e4d..ae534dcad4 100644 --- a/spec/integration/recipes/notifies_spec.rb +++ b/spec/integration/recipes/notifies_spec.rb @@ -28,11 +28,11 @@ describe "notifications" do it "should complete with success" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" log_level :warn EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) # our delayed notification should run at the end of the parent run_context after the baz resource expect(result.stdout).to match(/\* apt_update\[\] action nothing \(skipped due to action :nothing\)\s+\* log\[foo\] action write\s+\* log\[bar\] action write\s+\* apt_update\[\] action nothing \(skipped due to action :nothing\)/) result.error! @@ -69,11 +69,11 @@ describe "notifications" do it "should complete with success" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" log_level :warn EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) # our delayed notification should run at the end of the parent run_context after the baz resource expect(result.stdout).to match(/\* log\[bar\] action write\s+\* log\[baz\] action write\s+\* log\[foo\] action write/) result.error! @@ -112,11 +112,11 @@ describe "notifications" do it "should complete with success" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" log_level :warn EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) # our delayed notification should run at the end of the parent run_context after the baz resource expect(result.stdout).to match(/\* log\[bar\] action write\s+\* log\[baz\] action write\s+\* log\[foo\] action write/) # and only run once @@ -159,11 +159,11 @@ describe "notifications" do it "should complete with success" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" log_level :warn EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) # the delayed notification from the sub-resource is de-duplicated by the notification already in the parent run_context expect(result.stdout).to match(/\* log\[quux\] action write\s+\* notifying_test\[whatever\] action run\s+\* log\[bar\] action write\s+\* log\[baz\] action write\s+\* log\[foo\] action write\s+\* log\[baz\] action write/) # and only run once @@ -193,11 +193,11 @@ describe "notifications" do it "should complete with success" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" log_level :warn EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) # the delayed notification from the sub-resource is de-duplicated by the notification already in the parent run_context expect(result.stdout).to match(/\* log\[bar\] action write\s+\* log\[baz\] action write\s+\* log\[foo\] action write/) # and only run once @@ -236,11 +236,11 @@ describe "notifications" do it "should complete with success" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" log_level :warn EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) expect(result.stdout).to match(/\* log\[bar\] action write\s+\* log\[foo\] action write\s+\* log\[baz\] action write/) result.error! end @@ -276,11 +276,11 @@ describe "notifications" do it "should complete with success" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" log_level :warn EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) expect(result.stdout).to match(/\* log\[bar\] action write\s+\* log\[foo\] action write\s+\* log\[baz\] action write/) result.error! end @@ -313,11 +313,11 @@ describe "notifications" do it "should complete with success" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" log_level :warn EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) expect(result.stdout).to match(/Chef::Exceptions::ResourceNotFound/) expect(result.exitstatus).not_to eql(0) end @@ -353,11 +353,11 @@ describe "notifications" do it "should complete with success" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" log_level :warn EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) expect(result.stdout).not_to match(/CHEF-3694/) result.error! end @@ -381,11 +381,11 @@ describe "notifications" do it "notifying the resource should work" do file "config/client.rb", <<~EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" log_level :warn EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) expect(result.stdout).to match /\* log\[a, b\] action write/ result.error! end diff --git a/spec/integration/recipes/notifying_block_spec.rb b/spec/integration/recipes/notifying_block_spec.rb index 753e81dadb..465eca97ed 100644 --- a/spec/integration/recipes/notifying_block_spec.rb +++ b/spec/integration/recipes/notifying_block_spec.rb @@ -45,7 +45,7 @@ describe "notifying_block" do end file "config/client.rb", <<-EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" log_level :warn EOM end @@ -55,7 +55,7 @@ describe "notifying_block" do # 2. delayed notifications are de-dup'd in the subcontext # 3. delayed notifications (to resources inside the subcontext) are run at the end of the subcontext it "should run alpha, beta, gamma, and delta in that order" do - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) expect(result.stdout).to match(/\* log\[alpha\] action write\s+\* log\[beta\] action write\s+\* log\[gamma\] action write\s+Converging 1 resources\s+\* log\[delta\] action write/) result.error! end @@ -94,7 +94,7 @@ describe "notifying_block" do end file "config/client.rb", <<-EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" log_level :warn EOM end @@ -103,7 +103,7 @@ describe "notifying_block" do # 1. notifying block will correctly update wrapping new_resource updated_by_last_action status # 2. delayed notifications from a subcontext inside a resource will notify resources in their outer run_context it "should run foo, quux, bar, and baz in that order" do - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to("config/client.rb")}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) expect(result.stdout).to match(/\* log\[foo\] action write\s+\* log\[quux\] action write\s+\* log\[bar\] action write\s+\* log\[baz\] action write/) result.error! end diff --git a/spec/integration/recipes/remote_directory.rb b/spec/integration/recipes/remote_directory.rb index 6f67a38fc8..8332fb1b56 100644 --- a/spec/integration/recipes/remote_directory.rb +++ b/spec/integration/recipes/remote_directory.rb @@ -22,7 +22,7 @@ describe Chef::Resource::RemoteDirectory do before do file "config/client.rb", <<-EOM local_mode true - cookbook_path "#{path_to('cookbooks')}" + cookbook_path "#{path_to("cookbooks")}" EOM directory "cookbooks/test" do directory "files/default/source_dir" do @@ -50,7 +50,7 @@ describe Chef::Resource::RemoteDirectory do end EOM end - shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'test::default'", cwd: chef_dir) + shell_out!("#{chef_client} -c \"#{path_to("config/client.rb")}\" -o 'test::default'", cwd: chef_dir) end def mode_of(path) diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb index 0d24269199..451943e225 100644 --- a/spec/integration/solo/solo_spec.rb +++ b/spec/integration/solo/solo_spec.rb @@ -27,7 +27,7 @@ describe Chef::Dist::SOLOEXEC do file "config/solo.rb", <<~EOM chef_repo_path "#{@repository_dir}" EOM - result = shell_out("bundle exec chef-solo -c \"#{path_to('config/solo.rb')}\" -l debug", cwd: chef_dir) + result = shell_out("bundle exec chef-solo -c \"#{path_to("config/solo.rb")}\" -l debug", cwd: chef_dir) result.error! end @@ -76,25 +76,25 @@ describe Chef::Dist::SOLOEXEC do it "should complete with success" do file "config/solo.rb", <<~EOM - cookbook_path "#{path_to('cookbooks')}" - file_cache_path "#{path_to('config/cache')}" + 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')}" + cookbook_path "#{path_to("cookbooks")}" + file_cache_path "#{path_to("config/cache")}" EOM 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 @@ -112,10 +112,10 @@ describe Chef::Dist::SOLOEXEC do it "should exit with an error" do file "config/solo.rb", <<~EOM - cookbook_path "#{path_to('cookbooks')}" - file_cache_path "#{path_to('config/cache')}" + 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 @@ -126,13 +126,13 @@ describe Chef::Dist::SOLOEXEC 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')}" + 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 @@ -143,13 +143,13 @@ describe Chef::Dist::SOLOEXEC 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')}" + 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 @@ -175,8 +175,8 @@ describe Chef::Dist::SOLOEXEC do it "while running solo concurrently" do file "config/solo.rb", <<~EOM - cookbook_path "#{path_to('cookbooks')}" - file_cache_path "#{path_to('config/cache')}" + 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. @@ -188,13 +188,13 @@ describe Chef::Dist::SOLOEXEC do # 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 |