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/file_serving | |
| parent | 63c122f397c915cb1bec1a645958c808da92dce4 (diff) | |
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/file_serving')
| -rwxr-xr-x | spec/unit/file_serving/content.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/unit/file_serving/content.rb b/spec/unit/file_serving/content.rb index eacaff89f..cba703902 100755 --- a/spec/unit/file_serving/content.rb +++ b/spec/unit/file_serving/content.rb @@ -25,15 +25,15 @@ describe Puppet::FileServing::Content do Puppet::FileServing::Content.new("/path").should respond_to(:collect) end - it "should retrieve and store its contents when its attributes are collected if the file is a normal file" do + it "should not retrieve and store its contents when its attributes are collected if the file is a normal file" do content = Puppet::FileServing::Content.new("/path") result = "foo" File.stubs(:lstat).returns(stub("stat", :ftype => "file")) - File.expects(:read).with("/path").returns result + File.expects(:read).with("/path").never content.collect - content.instance_variable_get("@content").should_not be_nil + content.instance_variable_get("@content").should be_nil end it "should not attempt to retrieve its contents if the file is a directory" do @@ -70,6 +70,14 @@ describe Puppet::FileServing::Content do Puppet::FileServing::Content.from_raw("foo/bar").should equal(instance) end + + it "should return an opened File when converted to raw" do + content = Puppet::FileServing::Content.new("/path") + + File.expects(:new).with("/path","r").returns :file + + content.to_raw.should == :file + end end describe Puppet::FileServing::Content, "when returning the contents" do |
