diff options
author | Jeff Mendoza <jeffmendoza@live.com> | 2014-01-15 13:40:02 -0800 |
---|---|---|
committer | Jeff Mendoza <jeffmendoza@live.com> | 2014-02-20 10:38:24 -0800 |
commit | 9f7bc6c735611d77e7328d0dc9e0d55ab2d72bf3 (patch) | |
tree | 799fdd8d5b0c8c1a19fc1fcc45ad0562db869877 /spec/unit/knife/ssh_spec.rb | |
parent | 364aa72ced08c7d23382b20912e35b2e02a54fb3 (diff) | |
download | chef-9f7bc6c735611d77e7328d0dc9e0d55ab2d72bf3.tar.gz |
CHEF-4962, knife ssh will use a cloud atttribute for port if available.
The Azure cloud can have multiple nodes behind a single ip/fqdn
with different ssh ports for each. knife ssh should be able to
run on a search of nodes and use the correct ssh port for each.
Diffstat (limited to 'spec/unit/knife/ssh_spec.rb')
-rw-r--r-- | spec/unit/knife/ssh_spec.rb | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb index eff7c9ba5b..9247db3c90 100644 --- a/spec/unit/knife/ssh_spec.rb +++ b/spec/unit/knife/ssh_spec.rb @@ -54,7 +54,7 @@ describe Chef::Knife::Ssh do @knife.config[:attribute] = "ipaddress" @knife.config[:override_attribute] = "ipaddress" configure_query([@node_foo, @node_bar]) - @knife.should_receive(:session_from_list).with(['10.0.0.1', '10.0.0.2']) + @knife.should_receive(:session_from_list).with([['10.0.0.1', nil], ['10.0.0.2', nil]]) @knife.configure_session end @@ -62,14 +62,17 @@ describe Chef::Knife::Ssh do @knife.config[:attribute] = "config_file" # this value will be the config file @knife.config[:override_attribute] = "ipaddress" # this is the value of the command line via #configure_attribute configure_query([@node_foo, @node_bar]) - @knife.should_receive(:session_from_list).with(['10.0.0.1', '10.0.0.2']) + @knife.should_receive(:session_from_list).with([['10.0.0.1', nil], ['10.0.0.2', nil]]) @knife.configure_session end end it "searchs for and returns an array of fqdns" do configure_query([@node_foo, @node_bar]) - @knife.should_receive(:session_from_list).with(['foo.example.org', 'bar.example.org']) + @knife.should_receive(:session_from_list).with([ + ['foo.example.org', nil], + ['bar.example.org', nil] + ]) @knife.configure_session end @@ -83,7 +86,10 @@ describe Chef::Knife::Ssh do it "returns an array of cloud public hostnames" do configure_query([@node_foo, @node_bar]) - @knife.should_receive(:session_from_list).with(['ec2-10-0-0-1.compute-1.amazonaws.com', 'ec2-10-0-0-2.compute-1.amazonaws.com']) + @knife.should_receive(:session_from_list).with([ + ['ec2-10-0-0-1.compute-1.amazonaws.com', nil], + ['ec2-10-0-0-2.compute-1.amazonaws.com', nil] + ]) @knife.configure_session end @@ -179,12 +185,17 @@ describe Chef::Knife::Ssh do end it "uses the port from an ssh config file" do - @knife.session_from_list(['the.b.org']) + @knife.session_from_list([['the.b.org', nil]]) @knife.session.servers[0].port.should == 23 end + it "uses the port from a cloud attr" do + @knife.session_from_list([['the.b.org', 123]]) + @knife.session.servers[0].port.should == 123 + end + it "uses the user from an ssh config file" do - @knife.session_from_list(['the.b.org']) + @knife.session_from_list([['the.b.org', 123]]) @knife.session.servers[0].user.should == "locutus" end end |