diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2009-12-03 16:10:49 -0800 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2009-12-16 18:04:21 +1100 |
| commit | 1c69af2abea55579373e6111cf840197c7cb3494 (patch) | |
| tree | 3e73531636ba9cb0e6eaa7c8c365ccbc395660d3 /spec/unit/network | |
| parent | 3528a7b98c300f3ffa363d232b5f577f298390eb (diff) | |
| download | puppet-1c69af2abea55579373e6111cf840197c7cb3494.tar.gz puppet-1c69af2abea55579373e6111cf840197c7cb3494.tar.xz puppet-1c69af2abea55579373e6111cf840197c7cb3494.zip | |
Fixing 2855 Inadvertent zlib dependency
Disables the b64_zlib_yaml format if zlib cannot be loaded.
I've added a --no-zlib to make it possible to test this on a single
machine, but it might also be useful if someone finds themselves failing
to connect to a server that doesn't have zlib installed.
FactHandler' format is still hard-coded to YAML rather than using
facts.class.default_format
Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'spec/unit/network')
| -rwxr-xr-x | spec/unit/network/formats.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/unit/network/formats.rb b/spec/unit/network/formats.rb index b1ef9ec53..a241306a2 100755 --- a/spec/unit/network/formats.rb +++ b/spec/unit/network/formats.rb @@ -91,6 +91,9 @@ describe "Puppet Network Format" do end describe "base64 compressed yaml" do + yaml = Puppet::Network::FormatHandler.format(:b64_zlib_yaml) + confine "We must have zlib" => Puppet.features.zlib? + before do @yaml = Puppet::Network::FormatHandler.format(:b64_zlib_yaml) end @@ -173,6 +176,34 @@ describe "Puppet Network Format" do it "should fixup incorrect yaml to correct" do @yaml.fixup("&id004 !ruby/object:Puppet::Relationship ?").should == "? &id004 !ruby/object:Puppet::Relationship" end + + describe "when zlib is disabled" do + before do + Puppet[:zlib] = false + end + + it "use_zlib? should return false" do + @yaml.use_zlib?.should == false + end + + it "should refuse to encode" do + lambda{ @yaml.encode("foo") }.should raise_error + end + + it "should refuse to decode" do + lambda{ @yaml.decode("foo") }.should raise_error + end + end + + describe "when zlib is not installed" do + it "use_zlib? should return false" do + Puppet[:zlib] = true + Puppet.features.expects(:zlib?).returns(false) + + @yaml.use_zlib?.should == false + end + end + end it "should include a marshal format" do |
