From c93f286bb7c187522a1294ea8e52a5aa04273162 Mon Sep 17 00:00:00 2001 From: Nitz Date: Tue, 31 Mar 2015 18:12:35 +0300 Subject: Migrated deploy resource to use shell_out instead of run_command Should help with troubleshooting failed migrations --- spec/functional/resource/deploy_revision_spec.rb | 2 +- spec/unit/provider/deploy_spec.rb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'spec') diff --git a/spec/functional/resource/deploy_revision_spec.rb b/spec/functional/resource/deploy_revision_spec.rb index e5f5341fcd..4bce309a51 100644 --- a/spec/functional/resource/deploy_revision_spec.rb +++ b/spec/functional/resource/deploy_revision_spec.rb @@ -819,7 +819,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do end before do - expect { deploy_that_fails.run_action(:deploy) }.to raise_error(Chef::Exceptions::Exec) + expect { deploy_that_fails.run_action(:deploy) }.to raise_error(Mixlib::ShellOut::ShellCommandFailed) deploy_to_latest_with_callback_tracking.run_action(:deploy) end diff --git a/spec/unit/provider/deploy_spec.rb b/spec/unit/provider/deploy_spec.rb index f6bb78823f..e6a7125e32 100644 --- a/spec/unit/provider/deploy_spec.rb +++ b/spec/unit/provider/deploy_spec.rb @@ -362,7 +362,7 @@ describe Chef::Provider::Deploy do it "skips the migration when resource.migrate => false but runs symlinks before migration" do @resource.migrate false - expect(@provider).not_to receive :run_command + expect(@provider).not_to receive :shell_out! expect(@provider).to receive :run_symlinks_before_migrate @provider.migrate end @@ -378,7 +378,7 @@ describe Chef::Provider::Deploy do allow(STDOUT).to receive(:tty?).and_return(true) allow(Chef::Log).to receive(:info?).and_return(true) - expect(@provider).to receive(:run_command).with(:command => "migration_foo", :cwd => @expected_release_dir, + expect(@provider).to receive(:shell_out!).with("migration_foo",:cwd => @expected_release_dir, :user => "deployNinja", :group => "deployNinjas", :log_level => :info, :live_stream => STDOUT, :log_tag => "deploy[/my/deploy/dir]", @@ -445,13 +445,13 @@ describe Chef::Provider::Deploy do end it "does nothing for restart if restart_command is empty" do - expect(@provider).not_to receive(:run_command) + expect(@provider).not_to receive(:shell_out!) @provider.restart end it "runs the restart command in the current application dir when the resource has a restart_command" do @resource.restart_command "restartcmd" - expect(@provider).to receive(:run_command).with(:command => "restartcmd", :cwd => "/my/deploy/dir/current", :log_tag => "deploy[/my/deploy/dir]", :log_level => :debug) + expect(@provider).to receive(:shell_out!).with("restartcmd", :cwd => "/my/deploy/dir/current", :log_tag => "deploy[/my/deploy/dir]", :log_level => :debug) @provider.restart end @@ -509,7 +509,7 @@ describe Chef::Provider::Deploy do it "shouldn't give a no method error on migrate if the environment is nil" do allow(@provider).to receive(:enforce_ownership) allow(@provider).to receive(:run_symlinks_before_migrate) - allow(@provider).to receive(:run_command) + allow(@provider).to receive(:shell_out!) @provider.migrate end -- cgit v1.2.1