From 9ee924785e46c7cddc9db13df5de3e10b1de53fa Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Tue, 26 Jan 2016 15:37:59 -0800 Subject: explicit specs for EOFErrors --- .../error_inspectors/api_error_formatting.rb | 6 ++--- spec/unit/formatters/base_spec.rb | 29 +++++++++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/lib/chef/formatters/error_inspectors/api_error_formatting.rb b/lib/chef/formatters/error_inspectors/api_error_formatting.rb index a87166e168..a327089121 100644 --- a/lib/chef/formatters/error_inspectors/api_error_formatting.rb +++ b/lib/chef/formatters/error_inspectors/api_error_formatting.rb @@ -42,11 +42,11 @@ Received an EOF on transport socket. This almost always indicates a network error external to chef-client. Some causes include: - Blocking ICMP Dest Unreachable (breaking Path MTU Discovery) - - IPsec or VPN tunnelling breaking Path MTU + - IPsec or VPN tunnelling / TCP Encapsulation MTU issues - Jumbo frames configured only on one side (breaking Path MTU) - Jumbo frames configured on a LAN that does not support them - Proxies or Load Balancers breaking large POSTs - - Broken TCP offload + - Broken TCP offload in network drivers/hardware Try sending large pings to the destination: @@ -68,7 +68,7 @@ Try disabling TCP Offload Engines (TOE) in your ethernet drivers. for i in rx tx sg tso ufo gso gro lro rxvlan txvlan rxhash; do /sbin/ethtool -K eth0 $i off; done In some cases the underlying virtualization layer (Xen, VMware, KVM, Hyper-V, etc) may have -broken networking. +broken virtual networking code. E end diff --git a/spec/unit/formatters/base_spec.rb b/spec/unit/formatters/base_spec.rb index 9fe8109e98..ba11edaf18 100644 --- a/spec/unit/formatters/base_spec.rb +++ b/spec/unit/formatters/base_spec.rb @@ -20,8 +20,8 @@ require "spec_helper" describe Chef::Formatters::Base do - let(:out) { double("out") } - let(:err) { double("err") } + let(:out) { StringIO.new } + let(:err) { StringIO.new } let(:formatter) { Chef::Formatters::Base.new(out, err) } it "starts with an indentation of zero" do @@ -43,6 +43,29 @@ describe Chef::Formatters::Base do formatter.indent_by(-2) expect(formatter.output.indent).to eql(0) end -end + it "humanizes EOFError exceptions for #registration_failed" do + formatter.registration_failed("foo.example.com", EOFError.new, double("Chef::Config")) + expect(out.string).to match(/Received an EOF on transport socket/) + end + + it "humanizes EOFError exceptions for #node_load_failed" do + formatter.node_load_failed("foo.example.com", EOFError.new, double("Chef::Config")) + expect(out.string).to match(/Received an EOF on transport socket/) + end + + it "humanizes EOFError exceptions for #run_list_expand_failed" do + formatter.run_list_expand_failed(double("Chef::Node"), EOFError.new) + expect(out.string).to match(/Received an EOF on transport socket/) + end + + it "humanizes EOFError exceptions for #cookbook_resolution_failed" do + formatter.run_list_expand_failed(double("Expanded Run List"), EOFError.new) + expect(out.string).to match(/Received an EOF on transport socket/) + end + it "humanizes EOFError exceptions for #cookbook_sync_failed" do + formatter.cookbook_sync_failed("foo.example.com", EOFError.new) + expect(out.string).to match(/Received an EOF on transport socket/) + end +end -- cgit v1.2.1