Sha256: 44e083d08bd5c61012e853f6ed4d29fe3e39705196b0346298f23efde2d74d8a

Contents?: true

Size: 1.75 KB

Versions: 28

Compression:

Stored size: 1.75 KB

Contents

require "#{File.dirname(__FILE__)}/../../test_helper"
require File.dirname(__FILE__)+"/cloud_provider_instance_test.rb"

stub_keypair_searchable_paths

module  CloudProviders
  module Connections
    def system_run(cmds, opts={})
      return cmds
    end
  end
  
  class CloudProviderInstance
    def cloud_provider(opts={}, &block)
      {:keypair=>Keypair.new(fixtures_dir/"keys/test_key")}
    end
  end
  
end

class ConnectionsTest < Test::Unit::TestCase
  
  def inst
    @inst ||= CloudProviders::CloudProviderInstance.new( 
                :keypair_name => 'test_key',
                :status       => 'pending',
                :dns_name     => 'bigboy'
              )
  end
  
  def test_default_user
    assert_equal 'root', inst.user
    assert_equal 'fred', inst.user('fred')
    assert_equal 'fred', inst.user
  end
  
  def test_host
    assert_equal 'bigboy', inst.host
    assert_equal inst.dns_name, inst.host
    assert_equal 'bigsite', inst.host('bigsite')
    assert_equal 'bigsite', inst.host 
  end
  
  def test_ssh
    assert_match /ssh root@bigboy .* -i (.*)test_key 'uptime'$/, inst.ssh('uptime')
  end
  
  def test_run
    assert_match /ssh root@bigboy .* -i (.*)test_key 'uptime'$/, inst.run('uptime')
    assert_match /ssh root@bigboy (.*)--sshoptions foo (.*)'uptime'$/, inst.ssh('uptime', {'--sshoptions'=>'foo'})
  end
  
  def test_rsync
    assert_match /rsync/, inst.rsync(:source=>fixtures_dir/'templates')
  end
  
  def test_ssh_options
    assert_match /-o StrictHostKeyChecking=no -i (.*)keys\/test_key/, inst.ssh_options
  end
  
  def test_simplest_run_remote
  end
  
  def test_rsync_to    
  end
  
  def test_scp
    assert_match /scp (.*)\/templates\/script root@bigboy/, inst.scp(:source=>fixtures_dir/'templates/script')
  end
  
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
auser-poolparty-1.3.0 test/lib/cloud_providers/connections_test.rb
auser-poolparty-1.3.1 test/lib/cloud_providers/connections_test.rb
auser-poolparty-1.3.10 test/lib/cloud_providers/connections_test.rb
auser-poolparty-1.3.11 test/lib/cloud_providers/connections_test.rb
auser-poolparty-1.3.12 test/lib/cloud_providers/connections_test.rb
auser-poolparty-1.3.13 test/lib/cloud_providers/connections_test.rb
auser-poolparty-1.3.14 test/lib/cloud_providers/connections_test.rb
auser-poolparty-1.3.15 test/lib/cloud_providers/connections_test.rb
auser-poolparty-1.3.16 test/lib/cloud_providers/connections_test.rb
auser-poolparty-1.3.17 test/lib/cloud_providers/connections_test.rb
auser-poolparty-1.3.2 test/lib/cloud_providers/connections_test.rb
auser-poolparty-1.3.3 test/lib/cloud_providers/connections_test.rb
auser-poolparty-1.3.4 test/lib/cloud_providers/connections_test.rb
auser-poolparty-1.3.5 test/lib/cloud_providers/connections_test.rb
auser-poolparty-1.3.6 test/lib/cloud_providers/connections_test.rb
auser-poolparty-1.3.7 test/lib/cloud_providers/connections_test.rb
auser-poolparty-1.3.8 test/lib/cloud_providers/connections_test.rb
fairchild-poolparty-1.3.17 test/lib/cloud_providers/connections_test.rb
fairchild-poolparty-1.3.5 test/lib/cloud_providers/connections_test.rb
poolparty-1.3.15 test/lib/cloud_providers/connections_test.rb