Permalink
Browse files

Merge branches 'add-gateway-support' and 'rollback-on-rsync-failure'

  • Loading branch information...
2 parents 27640fe + 47945cb commit 4d0175089f44bd1fb3cdc09ad8965b14f8c862cc @mcary committed Jul 12, 2011
@@ -36,7 +36,7 @@ def update_local_cache
def update_remote_cache
finder_options = {:except => { :no_release => true }}
- find_servers(finder_options).each {|s| system(rsync_command_for(s)) }
+ find_servers(finder_options).each {|s| system(rsync_command_for(s)) or raise "Command failed" }
end
def copy_remote_cache
@@ -275,12 +275,25 @@ class CapistranoRsyncWithRemoteCacheTest < Test::Unit::TestCase
@strategy.stubs(:rsync_command_for).with(server_1).returns('server_1_rsync_command')
@strategy.stubs(:rsync_command_for).with(server_2).returns('server_2_rsync_command')
- @strategy.expects(:system).with('server_1_rsync_command')
- @strategy.expects(:system).with('server_2_rsync_command')
+ @strategy.expects(:system).with('server_1_rsync_command').returns(true)
+ @strategy.expects(:system).with('server_2_rsync_command').returns(true)
@strategy.update_remote_cache
end
+ should "notice failure to update teh remote cache" do
+ server_1, server_2 = [stub(), stub()]
+ @strategy.stubs(:find_servers).with(:except => {:no_release => true}).returns([server_1, server_2])
+
+ @strategy.stubs(:rsync_command_for).with(server_1).returns('server_1_rsync_command')
+ @strategy.stubs(:rsync_command_for).with(server_2).returns('server_2_rsync_command')
+
+ @strategy.expects(:system).with('server_1_rsync_command').returns(false)
+ @strategy.expects(:system).with('server_2_rsync_command').never
+
+ lambda { @strategy.update_remote_cache }.should raise_error
+ end
+
should "be able copy the remote cache into place" do
@strategy.stubs(
:repository_cache_path => 'repository_cache_path',

0 comments on commit 4d01750

Please sign in to comment.