diff options
author | danielsdeleo <dan@opscode.com> | 2013-10-23 09:55:20 -0700 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-10-23 09:55:20 -0700 |
commit | 332e295c93ef82a386906f831ff2693feac46934 (patch) | |
tree | dc4a95b37343371d7bee79f3f91b172cc8ef7a11 /spec/functional/resource/remote_file_spec.rb | |
parent | 90dfbc0f4dcee109d4e693c4fa5aaea7b19ba9ed (diff) | |
download | chef-332e295c93ef82a386906f831ff2693feac46934.tar.gz |
Update remote_file to expect nil return for 304 response
Recent changes to Chef's HTTP code have modified the behavior of the
HTTP#streaming_request function; it now catches HTTP 304 responses
internally and returns nil instead of raising an error. The cache
control handling code in `remote_file` HTTP backend needs a
corresponding update to appropriately branch for the not-modified case.
Diffstat (limited to 'spec/functional/resource/remote_file_spec.rb')
-rw-r--r-- | spec/functional/resource/remote_file_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/functional/resource/remote_file_spec.rb b/spec/functional/resource/remote_file_spec.rb index 9d68389a77..bfc09dccd9 100644 --- a/spec/functional/resource/remote_file_spec.rb +++ b/spec/functional/resource/remote_file_spec.rb @@ -83,6 +83,19 @@ describe Chef::Resource::RemoteFile do stop_tiny_server end + describe "when redownload isn't necessary" do + let(:source) { 'http://localhost:9000/seattle_capo.png' } + + before do + @api.get("/seattle_capo.png", 304, "", { 'Etag' => 'abcdef' } ) + end + + it "does not fetch the file" do + resource.run_action(:create) + end + + end + context "when using normal encoding" do let(:source) { 'http://localhost:9000/nyan_cat.png' } let(:expected_content) do @@ -112,6 +125,7 @@ describe Chef::Resource::RemoteFile do it_behaves_like "a securable resource with reporting" end + end context "when fetching files over HTTPS" do |