summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlinyows <linyows@gmail.com>2018-01-24 16:49:33 +0900
committerlinyows <linyows@gmail.com>2018-01-24 16:49:33 +0900
commitdb797fac6999dbb0b4da0bbfeab88a297e29c2c0 (patch)
tree5f4bc8c04726d57adb00f7ae46b85045aa2fb16c
parentee2a0aba8eb6f64274739521183a39c32baad80d (diff)
downloadchef-db797fac6999dbb0b4da0bbfeab88a297e29c2c0.tar.gz
add test
Signed-off-by: linyows <linyows@gmail.com>
-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 af54115ac7..ecfca88924 100644
--- a/spec/unit/knife/ssh_spec.rb
+++ b/spec/unit/knife/ssh_spec.rb
@@ -137,6 +137,23 @@ describe Chef::Knife::Ssh do
@knife.configure_session
end
end
+
+ context "when there are some hosts found but IPs duplicated" do
+ before do
+ @node_foo["fqdn"] = "foo.example.org"
+ @node_bar["fqdn"] = "foo.example.org"
+ end
+
+ it "should raise a specific error" do
+ expect(@knife.ui).to receive(:fatal).with(/^SSH node is duplicated: foo\.example\.org/)
+ expect(@knife).to receive(:exit).with(10)
+ expect(@knife).to receive(:session_from_list).with([
+ ["foo.example.org", nil, nil],
+ ["foo.example.org", nil, nil],
+ ])
+ @knife.configure_session
+ end
+ end
end
context "manual is set to true" do