summaryrefslogtreecommitdiff
path: root/spec/unit/provider/deploy_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/provider/deploy_spec.rb')
-rw-r--r--spec/unit/provider/deploy_spec.rb41
1 files changed, 2 insertions, 39 deletions
diff --git a/spec/unit/provider/deploy_spec.rb b/spec/unit/provider/deploy_spec.rb
index 4a8e5b8bff..ebbc6e2823 100644
--- a/spec/unit/provider/deploy_spec.rb
+++ b/spec/unit/provider/deploy_spec.rb
@@ -59,12 +59,6 @@ describe Chef::Provider::Deploy do
@provider.deploy
end
- it "creates deploy_to dir before calling update_cached_repo (CHEF-3435)" do
- ::Dir.should_receive(:chdir).with(@expected_release_dir).exactly(4).times
- @provider.send(:converge_actions).should_receive(:empty?).and_return(false)
- @provider.should_receive(:update_cached_repo).ordered
- @provider.deploy
- end
end
it "does not create deploy_to dir if it exists" do
@@ -77,7 +71,6 @@ describe Chef::Provider::Deploy do
@provider.stub(:symlink)
@provider.stub(:migrate)
@provider.deploy
- @provider.converge
end
it "ensures the deploy_to dir ownership after the verfication that it exists" do
@@ -109,7 +102,6 @@ describe Chef::Provider::Deploy do
@provider.should_receive(:callback).with(:after_restart, nil)
@provider.should_receive(:cleanup!)
@provider.deploy
- @provider.converge
end
it "should not deploy if there is already a deploy at release_path, and it is the current release" do
@@ -137,7 +129,6 @@ describe Chef::Provider::Deploy do
@resource.svn_force_export true
@provider.scm_provider.should_receive(:run_action).with(:force_export)
@provider.update_cached_repo
- @provider.converge
end
it "Removes the old release before deploying when force deploying over it" do
@@ -262,7 +253,6 @@ describe Chef::Provider::Deploy do
@runner.should_receive(:converge)
callback_code = Proc.new { :noop }
@provider.callback(:whatevs, callback_code)
- @provider.converge
end
it "loads callback files from the release/ dir if the file exists" do
@@ -271,7 +261,6 @@ describe Chef::Provider::Deploy do
::Dir.should_receive(:chdir).with(@expected_release_dir).and_yield
@provider.should_receive(:from_file).with(foo_callback)
@provider.callback(:foo, "deploy/foo.rb")
- @provider.converge
end
it "raises a runtime error if a callback file is explicitly specified but does not exist" do
@@ -289,7 +278,6 @@ describe Chef::Provider::Deploy do
::Dir.should_receive(:chdir).with(@expected_release_dir).and_yield
@provider.should_receive(:from_file).with(bar_callback)
@provider.callback(:bar, nil)
- @provider.converge
end
it "skips an eval callback if the file doesn't exist" do
@@ -298,7 +286,6 @@ describe Chef::Provider::Deploy do
::Dir.should_receive(:chdir).with(@expected_release_dir).and_yield
@provider.should_not_receive(:from_file)
@provider.callback(:barbaz, nil)
- @provider.converge
end
# CHEF-3449 #converge_by is called in #recipe_eval and must happen in sequence
@@ -329,14 +316,12 @@ describe Chef::Provider::Deploy do
it "syncs the cached copy of the repo" do
@provider.scm_provider.should_receive(:run_action).with(:sync)
@provider.update_cached_repo
- @provider.converge
end
it "makes a copy of the cached repo in releases dir" do
FileUtils.should_receive(:mkdir_p).with("/my/deploy/dir/releases")
@provider.should_receive(:run_command).with({:command => "cp -RPp /my/deploy/dir/shared/cached-copy/. #{@expected_release_dir}"})
@provider.copy_cached_repo
- @provider.converge
end
it "calls the internal callback :release_created when copying the cached repo" do
@@ -344,7 +329,6 @@ describe Chef::Provider::Deploy do
@provider.stub!(:run_command).and_return(true)
@provider.should_receive(:release_created)
@provider.copy_cached_repo
- @provider.converge
end
it "chowns the whole release dir to user and group specified in the resource" do
@@ -352,7 +336,6 @@ describe Chef::Provider::Deploy do
@resource.group "bar"
FileUtils.should_receive(:chown_R).with("foo", "bar", "/my/deploy/dir")
@provider.enforce_ownership
- @provider.converge
end
it "skips the migration when resource.migrate => false but runs symlinks before migration" do
@@ -360,7 +343,6 @@ describe Chef::Provider::Deploy do
@provider.should_not_receive :run_command
@provider.should_receive :run_symlinks_before_migrate
@provider.migrate
- @provider.converge
end
it "links the database.yml and runs resource.migration_command when resource.migrate #=> true" do
@@ -380,7 +362,6 @@ describe Chef::Provider::Deploy do
:log_tag => "deploy[/my/deploy/dir]",
:environment => {"RAILS_ENV"=>"production"})
@provider.migrate
- @provider.converge
end
it "purges the current release's /log /tmp/pids/ and /public/system directories" do
@@ -388,7 +369,6 @@ describe Chef::Provider::Deploy do
FileUtils.should_receive(:rm_rf).with(@expected_release_dir + "/tmp/pids")
FileUtils.should_receive(:rm_rf).with(@expected_release_dir + "/public/system")
@provider.purge_tempfiles_from_current_release
- @provider.converge
end
it "symlinks temporary files and logs from the shared dir into the current release" do
@@ -404,7 +384,6 @@ describe Chef::Provider::Deploy do
FileUtils.should_receive(:ln_sf).with("/my/deploy/dir/shared/config/database.yml", @expected_release_dir + "/config/database.yml")
@provider.should_receive(:enforce_ownership)
@provider.link_tempfiles_to_current_release
- @provider.converge
end
it "symlinks the current release dir into production" do
@@ -412,7 +391,6 @@ describe Chef::Provider::Deploy do
FileUtils.should_receive(:ln_sf).with(@expected_release_dir, "/my/deploy/dir/current")
@provider.should_receive(:enforce_ownership)
@provider.link_current_release_to_production
- @provider.converge
end
context "with a customized app layout" do
@@ -422,14 +400,12 @@ describe Chef::Provider::Deploy do
@resource.create_dirs_before_symlink(%w{baz qux})
@resource.symlinks "foo/bar" => "foo/bar", "baz" => "qux/baz"
@resource.symlink_before_migrate "radiohead/in_rainbows.yml" => "awesome"
- @provider.converge
end
it "purges the purge_before_symlink directories" do
FileUtils.should_receive(:rm_rf).with(@expected_release_dir + "/foo")
FileUtils.should_receive(:rm_rf).with(@expected_release_dir + "/bar")
@provider.purge_tempfiles_from_current_release
- @provider.converge
end
it "symlinks files from the shared directory to the current release directory" do
@@ -442,7 +418,6 @@ describe Chef::Provider::Deploy do
FileUtils.should_receive(:ln_sf).with("/my/deploy/dir/shared/radiohead/in_rainbows.yml", @expected_release_dir + "/awesome")
@provider.should_receive(:enforce_ownership)
@provider.link_tempfiles_to_current_release
- @provider.converge
end
end
@@ -450,14 +425,12 @@ describe Chef::Provider::Deploy do
it "does nothing for restart if restart_command is empty" do
@provider.should_not_receive(:run_command)
@provider.restart
- @provider.converge
end
it "runs the restart command in the current application dir when the resource has a restart_command" do
@resource.restart_command "restartcmd"
@provider.should_receive(:run_command).with(:command => "restartcmd", :cwd => "/my/deploy/dir/current", :log_tag => "deploy[/my/deploy/dir]", :log_level => :debug)
@provider.restart
- @provider.converge
end
it "lists all available releases" do
@@ -477,7 +450,6 @@ describe Chef::Provider::Deploy do
FileUtils.should_receive(:rm_rf).with("/my/deploy/dir/20040200000000")
FileUtils.should_receive(:rm_rf).with("/my/deploy/dir/20040300000000")
@provider.cleanup!
- @provider.converge
end
it "removes all but a certain number of releases when the resource has a keep_releases" do
@@ -489,7 +461,6 @@ describe Chef::Provider::Deploy do
@provider.stub!(:all_releases).and_return(all_releases)
FileUtils.should_receive(:rm_rf).with("/my/deploy/dir/20040100000000")
@provider.cleanup!
- @provider.converge
end
it "fires a callback for :release_deleted when deleting an old release" do
@@ -500,7 +471,6 @@ describe Chef::Provider::Deploy do
FileUtils.stub!(:rm_rf)
@provider.should_receive(:release_deleted).with("/my/deploy/dir/20040300000000")
@provider.cleanup!
- @provider.converge
end
it "puts resource.to_hash in @configuration for backwards compat with capistano-esque deploy hooks" do
@@ -512,7 +482,6 @@ describe Chef::Provider::Deploy do
resource.environment "production"
provider = Chef::Provider::Deploy.new(resource, @run_context)
provider.instance_variable_get(:@configuration)[:environment].should eql("production")
- @provider.converge
end
it "shouldn't give a no method error on migrate if the environment is nil" do
@@ -520,7 +489,7 @@ describe Chef::Provider::Deploy do
@provider.stub!(:run_symlinks_before_migrate)
@provider.stub!(:run_command)
@provider.migrate
- @provider.converge
+
end
context "using inline recipes for callbacks" do
@@ -530,7 +499,6 @@ describe Chef::Provider::Deploy do
recipe_code = Proc.new {snitch = 42}
#@provider.should_receive(:instance_eval).with(&recipe_code)
@provider.callback(:whateverz, recipe_code)
- @provider.converge
snitch.should == 42
end
@@ -539,7 +507,6 @@ describe Chef::Provider::Deploy do
::Dir.should_receive(:chdir).with(@expected_release_dir).and_yield
@provider.should_receive(:from_file).with(@expected_release_dir + "/chefz/foobar_callback.rb")
@provider.callback(:whateverz, "chefz/foobar_callback.rb")
- @provider.converge
end
it "instance_evals a block/proc for restart command" do
@@ -547,7 +514,6 @@ describe Chef::Provider::Deploy do
restart_cmd = Proc.new {snitch = 42}
@resource.restart(&restart_cmd)
@provider.restart
- @provider.converge
snitch.should == 42
end
@@ -557,7 +523,6 @@ describe Chef::Provider::Deploy do
it "defines sudo as a forwarder to execute" do
@provider.should_receive(:execute).with("the moon, fool")
@provider.sudo("the moon, fool")
- @provider.converge
end
it "defines run as a forwarder to execute, setting the user, group, cwd and environment to new_resource.user" do
@@ -586,7 +551,7 @@ describe Chef::Provider::Deploy do
end
}.twice
@provider.run("iGoToHell4this")
- @provider.converge
+
end
it "defines run as a forwarder to execute, setting cwd and environment but not override" do
@@ -597,7 +562,6 @@ describe Chef::Provider::Deploy do
mock_execution.should_receive(:cwd).with(no_args()).and_return("/some/value")
mock_execution.should_receive(:environment).with(no_args()).and_return({})
@provider.run("iGoToHell4this")
- @provider.converge
end
@@ -618,7 +582,6 @@ describe Chef::Provider::Deploy do
runner.should_receive(:converge)
#
@provider.callback(:phony, callback_code)
- @provider.converge
snitch.should be_an_instance_of(Chef::Resource::Execute)
snitch.user.should == "tehCat"
end