Get tests passing for GH-508

This commit is contained in:
Mitchell Hashimoto 2011-11-24 21:52:31 -07:00
parent f6055f8711
commit c2ef1329aa
3 changed files with 4 additions and 3 deletions

View File

@ -11,6 +11,7 @@
- Chef provisioners no longer depend on a "v-root" share being - Chef provisioners no longer depend on a "v-root" share being
available. [GH-556] available. [GH-556]
- NFS should work for FreeBSD hosts now. [GH-510] - NFS should work for FreeBSD hosts now. [GH-510]
- SSH executed methods respect `config.ssh.max_tries`. [GH-508]
## 0.8.7 (September 13, 2011) ## 0.8.7 (September 13, 2011)

View File

@ -10,8 +10,8 @@ class SshSessionTest < Test::Unit::TestCase
end end
context "exec!" do context "exec!" do
should "retry 5 times" do should "retry max_tries times" do
@session.expects(:open_channel).times(5).raises(IOError) @session.expects(:open_channel).times(@env.config.ssh.max_tries).raises(IOError)
assert_raises(IOError) { assert_raises(IOError) {
@instance.exec!("foo") @instance.exec!("foo")
} }

View File

@ -197,7 +197,7 @@ class SshTest < Test::Unit::TestCase
end end
should "return false if the connection is refused" do should "return false if the connection is refused" do
Net::SSH.expects(:start).times(5).raises(Errno::ECONNREFUSED) Net::SSH.expects(:start).times(@env.config.ssh.max_tries).raises(Errno::ECONNREFUSED)
assert_nothing_raised { assert_nothing_raised {
assert !@ssh.up? assert !@ssh.up?
} }