summaryrefslogtreecommitdiff
path: root/spec/unit/knife_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/knife_spec.rb')
-rw-r--r--spec/unit/knife_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb
index c87d80f96f..2ccf8493ad 100644
--- a/spec/unit/knife_spec.rb
+++ b/spec/unit/knife_spec.rb
@@ -435,6 +435,21 @@ describe Chef::Knife do
expect(stderr.string).to match(%r[Check your knife configuration and network settings])
end
+ it "formats SSL errors nicely and suggests to use `knife ssl check` and `knife ssl fetch`" do
+ error = OpenSSL::SSL::SSLError.new("SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed")
+ allow(knife).to receive(:run).and_raise(error)
+
+ knife.run_with_pretty_exceptions
+
+ expected_message=<<-MSG
+ERROR: Could not establish a secure connection to the server.
+Use `knife ssl check` to troubleshoot your SSL configuration.
+If your Chef Server uses a self-signed certificate, you can use
+`knife ssl fetch` to make knife trust the server's certificates.
+MSG
+ expect(stderr.string).to include(expected_message)
+ end
+
end
end