diff options
author | Eric Herot <eric.github@herot.com> | 2015-03-24 13:27:15 -0400 |
---|---|---|
committer | Eric Herot <eric.github@herot.com> | 2015-03-24 13:27:15 -0400 |
commit | 32f787fe9aa273c6705f49dfd591bcb09891c277 (patch) | |
tree | 451feaeb2068d13afb89ab2c803fe3b3df7ddc35 | |
parent | 7144c8baf025c01922702b7abf106f6b7957dfdb (diff) | |
download | chef-32f787fe9aa273c6705f49dfd591bcb09891c277.tar.gz |
Add a unit test for the empty public_hostname check on knife ssh
-rw-r--r-- | spec/unit/knife/ssh_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb index 501b02c933..a838a21edc 100644 --- a/spec/unit/knife/ssh_spec.rb +++ b/spec/unit/knife/ssh_spec.rb @@ -96,6 +96,24 @@ describe Chef::Knife::Ssh do should_return_specified_attributes end + context "when cloud hostnames are available but empty" do + before do + @node_foo.automatic_attrs[:cloud][:public_hostname] = '' + @node_bar.automatic_attrs[:cloud][:public_hostname] = '' + end + + it "returns an array of fqdns" do + configure_query([@node_foo, @node_bar]) + expect(@knife).to receive(:session_from_list).with([ + ['foo.example.org', nil], + ['bar.example.org', nil] + ]) + @knife.configure_session + end + + should_return_specified_attributes + end + it "should raise an error if no host are found" do configure_query([ ]) expect(@knife.ui).to receive(:fatal) |