diff options
Diffstat (limited to 'spec/unit/resource_reporter_spec.rb')
-rw-r--r-- | spec/unit/resource_reporter_spec.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/spec/unit/resource_reporter_spec.rb b/spec/unit/resource_reporter_spec.rb index 4469dbb240..084ae99e43 100644 --- a/spec/unit/resource_reporter_spec.rb +++ b/spec/unit/resource_reporter_spec.rb @@ -412,7 +412,8 @@ describe Chef::ResourceReporter do @response = Net::HTTPNotFound.new("a response body", "404", "Not Found") @error = Net::HTTPServerException.new("404 message", @response) @rest_client.should_receive(:post_rest). - with("reports/nodes/spitfire/runs", {:action => :begin, :run_id => @run_id}). + with("reports/nodes/spitfire/runs", {:action => :begin, :run_id => @run_id}, + {'X-Ops-Reporting-Protocol-Version' => Chef::ResourceReporter::PROTOCOL_VERSION}). and_raise(@error) end @@ -440,7 +441,8 @@ describe Chef::ResourceReporter do @response = Net::HTTPInternalServerError.new("a response body", "500", "Internal Server Error") @error = Net::HTTPServerException.new("500 message", @response) @rest_client.should_receive(:post_rest). - with("reports/nodes/spitfire/runs", {:action => :begin, :run_id => @run_id}). + with("reports/nodes/spitfire/runs", {:action => :begin, :run_id => @run_id}, + {'X-Ops-Reporting-Protocol-Version' => Chef::ResourceReporter::PROTOCOL_VERSION}). and_raise(@error) end @@ -469,7 +471,8 @@ describe Chef::ResourceReporter do @response = Net::HTTPInternalServerError.new("a response body", "500", "Internal Server Error") @error = Net::HTTPServerException.new("500 message", @response) @rest_client.should_receive(:post_rest). - with("reports/nodes/spitfire/runs", {:action => :begin, :run_id => @run_id}). + with("reports/nodes/spitfire/runs", {:action => :begin, :run_id => @run_id}, + {'X-Ops-Reporting-Protocol-Version' => Chef::ResourceReporter::PROTOCOL_VERSION}). and_raise(@error) end @@ -489,7 +492,8 @@ describe Chef::ResourceReporter do before do response = {"uri"=>"https://example.com/reports/nodes/spitfire/runs/@run_id"} @rest_client.should_receive(:post_rest). - with("reports/nodes/spitfire/runs", {:action => :begin, :run_id => @run_id}). + with("reports/nodes/spitfire/runs", {:action => :begin, :run_id => @run_id}, + {'X-Ops-Reporting-Protocol-Version' => Chef::ResourceReporter::PROTOCOL_VERSION}). and_return(response) @resource_reporter.node_load_completed(@node, :expanded_run_list, :config) @@ -517,7 +521,9 @@ describe Chef::ResourceReporter do @rest_client.should_receive(:raw_http_request).ordered do |method, url, headers, data| method.should eq(:POST) url.should eq(post_url) - headers.should eq({'Content-Encoding' => 'gzip'}) + headers.should eq({'Content-Encoding' => 'gzip', + 'X-Ops-Reporting-Protocol-Version' => Chef::ResourceReporter::PROTOCOL_VERSION + }) data_stream = Zlib::GzipReader.new(StringIO.new(data)) data = data_stream.read data.should eq(@expected_data.to_json) |