summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorSalim Alam <salam@chef.io>2016-03-30 09:41:38 -0700
committerSalim Alam <salam@chef.io>2016-03-30 09:41:38 -0700
commita7ffc40d060c73bb883307eaa3f3df3a63ae874c (patch)
tree3bcecdd67343a54a9b61ee7df10a6ee39f89f8dc /spec
parentc4c6faa08d90b7116c3a927f7147249d89913fab (diff)
parente82138ddf51e6f45fc3d215866ccc48845b6e0c3 (diff)
downloadchef-a7ffc40d060c73bb883307eaa3f3df3a63ae874c.tar.gz
Merge pull request #4767 from chef/salam/timeout
Add option to set knife ssh timeout
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/knife/ssh_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb
index 3a8728515d..65cc5a97b4 100644
--- a/spec/unit/knife/ssh_spec.rb
+++ b/spec/unit/knife/ssh_spec.rb
@@ -203,6 +203,23 @@ describe Chef::Knife::Ssh do
expect(@knife.session.servers[0].port).to eq(123)
end
+ it "uses the timeout from Chef Config" do
+ Chef::Config[:knife][:ssh_timeout] = 5
+ @knife.session_from_list([["the.b.org", nil]])
+ expect(@knife.session.servers[0].options[:timeout]).to eq(5)
+ end
+
+ it "uses the timeout from knife config" do
+ @knife.config[:ssh_timeout] = 6
+ @knife.session_from_list([["the.b.org", nil]])
+ expect(@knife.session.servers[0].options[:timeout]).to eq(6)
+ end
+
+ it "defaults to no timeout" do
+ @knife.session_from_list([["the.b.org", nil]])
+ expect(@knife.session.servers[0].options[:timeout]).to eq(nil)
+ end
+
it "uses the user from an ssh config file" do
@knife.session_from_list([["the.b.org", 123]])
expect(@knife.session.servers[0].user).to eq("locutus")