mirror of
				https://github.com/capistrano/capistrano
				synced 2023-03-27 23:21:18 -04:00 
			
		
		
		
	Fix parallel command execution logging parallely - GH434
Also add unit tests that reproduce the problem
This commit is contained in:
		
							parent
							
								
									c4bd4c4e03
								
							
						
					
					
						commit
						a08fe0d67d
					
				
					 4 changed files with 48 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -9,6 +9,7 @@ class ConfigurationActionsInvocationTest < Test::Unit::TestCase
 | 
			
		|||
    attr_accessor :dry_run
 | 
			
		||||
    attr_accessor :preserve_roles
 | 
			
		||||
    attr_accessor :servers
 | 
			
		||||
    attr_accessor :roles
 | 
			
		||||
 | 
			
		||||
    def initialize
 | 
			
		||||
      @options = {}
 | 
			
		||||
| 
						 | 
				
			
			@ -226,6 +227,37 @@ class ConfigurationActionsInvocationTest < Test::Unit::TestCase
 | 
			
		|||
    @config.invoke_command("ls", :once => true, :via => :foobar)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_parallel_command_execution_with_no_match
 | 
			
		||||
    assert_block("should not raise argument error") do
 | 
			
		||||
      begin
 | 
			
		||||
        @config.parallel do |session|
 | 
			
		||||
          session.when("in?(:app)", "ls") {|ch,stream,data| puts "noop"}
 | 
			
		||||
          session.when("in?(:db)", "pwd") {|ch,stream,data| puts "noop"}
 | 
			
		||||
        end
 | 
			
		||||
        true
 | 
			
		||||
      rescue
 | 
			
		||||
        false
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_parallel_command_execution_with_matching_servers
 | 
			
		||||
    @config.expects(:execute_on_servers)
 | 
			
		||||
    assert_block("should not raise Argument error") do
 | 
			
		||||
      begin
 | 
			
		||||
        @config.servers = [:app, :db]
 | 
			
		||||
        @config.roles = {:app => [:app], :db => [:db] }
 | 
			
		||||
        @config.parallel do |session|
 | 
			
		||||
          session.when("in?(:app)", "ls") {|ch,stream,data| puts "noop"}
 | 
			
		||||
          session.when("in?(:db)", "pwd") {|ch,stream,data| puts "noop"}
 | 
			
		||||
        end
 | 
			
		||||
        true
 | 
			
		||||
      rescue
 | 
			
		||||
        false
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  private
 | 
			
		||||
 | 
			
		||||
    def make_config
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue