diff options
| author | Brice Figureau <brice-puppet@daysofwonder.com> | 2010-04-10 16:30:03 +0200 |
|---|---|---|
| committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
| commit | ee5d7f196fa62046f8fc3d3d723da608b17ce531 (patch) | |
| tree | aa92df8067b573167034d62e08c6dbe4c0d35b47 /spec/unit/network/http/webrick | |
| parent | 63c122f397c915cb1bec1a645958c808da92dce4 (diff) | |
| download | puppet-ee5d7f196fa62046f8fc3d3d723da608b17ce531.tar.gz puppet-ee5d7f196fa62046f8fc3d3d723da608b17ce531.tar.xz puppet-ee5d7f196fa62046f8fc3d3d723da608b17ce531.zip | |
Add master side file content streaming
This patch allows the puppetmaster to serve file chunks by chunks without
ever reading the file content in RAM.
This allows serving large files directly with the master without impacting
the master memory footprint.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec/unit/network/http/webrick')
| -rwxr-xr-x | spec/unit/network/http/webrick/rest.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/unit/network/http/webrick/rest.rb b/spec/unit/network/http/webrick/rest.rb index f5c563e0d..f726fd9a7 100755 --- a/spec/unit/network/http/webrick/rest.rb +++ b/spec/unit/network/http/webrick/rest.rb @@ -69,6 +69,29 @@ describe Puppet::Network::HTTP::WEBrickREST do @handler.set_response(@response, "mybody", 200) end + describe "when the result is a File" do + before(:each) do + stat = stub 'stat', :size => 100 + @file = stub 'file', :stat => stat, :path => "/tmp/path" + @file.stubs(:is_a?).with(File).returns(true) + end + + it "should serve it" do + @response.stubs(:[]=) + + @response.expects(:status=).with 200 + @response.expects(:body=).with @file + + @handler.set_response(@response, @file, 200) + end + + it "should set the Content-Length header" do + @response.expects(:[]=).with('content-length', 100) + + @handler.set_response(@response, @file, 200) + end + end + it "should set the status and message on the response when setting the response for a failed query" do @response.expects(:status=).with 400 @response.expects(:reason_phrase=).with "mybody" |
