2

我已经在我的 Mac(运行 OSX 10.8.2)和 PC(运行 Windows 7)上安装了 ruby​​(1.9.3)。我已经安装(使用“gem install ...”)net-ssh、test-unit、mocha 和 echoe。安装看起来很干净(Mac 抱怨文档中有一些 unicode 垃圾,但我不在乎)。

当我运行发行版中包含的单元测试时,我遇到了失败和错误。它们在 Mac 和 PC 上是不同的。据我所知,我有必要的东西——ssh 正在工作,我的 .ssh 目录存在并且有一个 id_dsa 对和一个 id_rsa 对。

很长一段时间以来,我一直在使用 SSH(shell、sftp、scp 等)与我的 mac 进行连接,所以我认为我的 SSH 堆栈正在工作。

这是一个愚蠢的配置问题,还是 net-ssh/Ruby 中有问题?

在 Mac 上,我通过运行 net-ssh 测试套件得到以下结果:

tms-mac:test tms$ ruby -Ilib -Itest -rrubygems test_all.rb

*** Mocha deprecation warning: Change `require 'mocha'` to `require 'mocha/setup'`.

Loaded suite test_all
Started
...............................................................................
......................................F
===============================================================================
Failure:
test_for_should_load_all_files_and_translate_to_net_ssh_options(TestConfig)
/Users/tms/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/test/test_config.rb:35:in `test_for_should_load_all_files_and_translate_to_net_ssh_options'
     32: 
     33:   def test_for_should_load_all_files_and_translate_to_net_ssh_options
     34:     config = Net::SSH::Config.for("test.host", [config(:exact_match), config(:wild_cards)])
  => 35:     assert_equal 1234, config[:port]
     36:     assert config[:compression]
     37:     assert config[:forward_agent]
     38:     assert_equal %w(~/.ssh/id_dsa), config[:keys]
<1234> expected but was
<nil>

diff:
? 1234
? nil 
===============================================================================
..F
===============================================================================
Failure: <nil> is not true.
test_load_should_parse_equal_sign_delimiters(TestConfig)
/Users/tms/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/test/test_config.rb:65:in `test_load_should_parse_equal_sign_delimiters'
     62:   
     63:   def test_load_should_parse_equal_sign_delimiters
     64:     config = Net::SSH::Config.load(config(:eqsign), "test.test")
  => 65:     assert config['compression']
     66:     assert_equal 1234, config['port']
     67:   end
     68: 
===============================================================================
F
===============================================================================
Failure: <nil> is not true.
test_load_with_exact_host_match_should_load_that_section(TestConfig)
/Users/tms/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/test/test_config.rb:19:in `test_load_with_exact_host_match_should_load_that_section'
     16: 
     17:   def test_load_with_exact_host_match_should_load_that_section
     18:     config = Net::SSH::Config.load(config(:exact_match), "test.host")
  => 19:     assert config['compression']
     20:     assert config['forwardagent']
     21:     assert_equal 1234, config['port']
     22:   end
===============================================================================
F
===============================================================================
Failure: <nil> is not true.
test_load_with_multiple_hosts(TestConfig)
/Users/tms/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/test/test_config.rb:50:in `test_load_with_multiple_hosts'
     47:   
     48:   def test_load_with_multiple_hosts
     49:     config = Net::SSH::Config.load(config(:multihost), "test.host")
  => 50:     assert config['compression']
     51:     assert_equal '2G', config['rekeylimit']
     52:     assert_equal 1980, config['port']
     53:   end
===============================================================================
.F
===============================================================================
Failure:
test_load_with_no_host(TestConfig)
/Users/tms/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/test/test_config.rb:44:in `test_load_with_no_host'
     41:   
     42:   def test_load_with_no_host
     43:     config = Net::SSH::Config.load(config(:nohost), "test.host")
  => 44:     assert_equal %w(~/.ssh/id_dsa ~/.ssh/id_rsa), config['identityfile']
     45:     assert_equal 1985, config['port']
     46:   end
     47:   
<["~/.ssh/id_dsa", "~/.ssh/id_rsa"]> expected but was
<nil>

diff:
? ["~/.ssh/id_dsa", "~/.ssh/id_rsa"]
? n         l                       
===============================================================================
F
===============================================================================
Failure: <nil> is not true.
test_load_with_numeric_host(TestConfig)
/Users/tms/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/test/test_config.rb:110:in `test_load_with_numeric_host'
     107:   
     108:   def test_load_with_numeric_host
     109:     config = Net::SSH::Config.load(config(:numeric_host), "1234")
  => 110:     assert config['compression']
     111:     assert_equal '2G', config['rekeylimit']
     112:     assert_equal 1980, config['port']
     113:   end
===============================================================================
F
===============================================================================
Failure: <nil> is not true.
test_load_with_plus_sign_hosts(TestConfig)
/Users/tms/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/test/test_config.rb:105:in `test_load_with_plus_sign_hosts'
     102:   
     103:   def test_load_with_plus_sign_hosts
     104:     config = Net::SSH::Config.load(config(:host_plus), "test.host")
  => 105:     assert config['compression']
     106:   end
     107:   
     108:   def test_load_with_numeric_host
===============================================================================
F
===============================================================================
Failure:
test_load_with_wild_card_matches_should_load_all_matches_with_first_match_taking_precedence(TestConfig)
/Users/tms/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/test/test_config.rb:26:in `test_load_with_wild_card_matches_should_load_all_matches_with_first_match_taking_precedence'
     23: 
     24:   def test_load_with_wild_card_matches_should_load_all_matches_with_first_match_taking_precedence
     25:     config = Net::SSH::Config.load(config(:wild_cards), "test.host")
  => 26:     assert_equal 1234, config['port']
     27:     assert !config['compression']
     28:     assert config['forwardagent']
     29:     assert_equal %w(~/.ssh/id_dsa), config['identityfile']
<1234> expected but was
<nil>

diff:
? 1234
? nil 
===============================================================================
...............................................................................
...............................................................................
..............................E
===============================================================================
Error: test_authenticate_should_continue_if_method_disallowed(Authentication::TestSession)
  NameError: uninitialized constant Net::SSH::Authentication::Methods::None
/Users/tms/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/test/authentication/test_session.rb:24:in `test_authenticate_should_continue_if_method_disallowed'
     21: 
     22:       Net::SSH::Authentication::Methods::Publickey.any_instance.expects(:authenticate).with("next service", "username", "password").raises(Net::SSH::Authentication::DisallowedMethod)
     23:       Net::SSH::Authentication::Methods::Hostbased.any_instance.expects(:authenticate).with("next service", "username", "password").returns(true)
  => 24:       Net::SSH::Authentication::Methods::None.any_instance.expects(:authenticate).with("next service", "username", "password").returns(false)
     25: 
     26:       assert session.authenticate("next service", "username", "password")
     27:     end
===============================================================================
.E
===============================================================================
Error: test_authenticate_should_return_false_if_all_auth_methods_fail(Authentication::TestSession)
  NameError: uninitialized constant Net::SSH::Authentication::Methods::None
/Users/tms/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/test/authentication/test_session.rb:50:in `test_authenticate_should_return_false_if_all_auth_methods_fail'
     47:       Net::SSH::Authentication::Methods::Hostbased.any_instance.expects(:authenticate).with("next service", "username", "password").returns(false)
     48:       Net::SSH::Authentication::Methods::Password.any_instance.expects(:authenticate).with("next service", "username", "password").returns(false)
     49:       Net::SSH::Authentication::Methods::KeyboardInteractive.any_instance.expects(:authenticate).with("next service", "username", "password").returns(false)
  => 50:       Net::SSH::Authentication::Methods::None.any_instance.expects(:authenticate).with("next service", "username", "password").returns(false)
     51:       
     52:       assert_equal false, session.authenticate("next service", "username", "password")
     53:     end
===============================================================================
...............................................................................
...............................................................................
...............................................................................
...............................................................................
...............................................................................
...............................................................................
...............................................................................
...............................................................................
...............................................................................
...............................................................................
...............................................................................
...............................................................................
...............................................................................
...............................................................................
...............................................................................
...............................................................................
...............................................................................
...............................................................................
...............................................................................
...............................................................................
........................

Finished in 2.89621 seconds.

1923 tests, 6101 assertions, 8 failures, 2 errors, 0 pendings, 0 omissions, 0 notifications
99.48% passed

663.97 tests/s, 2106.55 assertions/s
4

0 回答 0