[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 2.6.5-303-gfcfa26a

Paul Berry paul at puppetlabs.com
Thu Mar 17 10:47:59 UTC 2011


The following commit has been merged in the upstream branch:
commit 23a510a321e47a98768dc47f95cfa0bd8c1a314c
Author: Paul Berry <paul at puppetlabs.com>
Date:   Fri Feb 25 14:56:58 2011 -0800

    (#4914) Improved stubbing in mount/parsed_spec tests.
    
    A few of the spec tests were attempting to stub
    Puppet::Type::Mount#default_target so that it pointed to a temporary
    file rather than /etc/fstab, but they were creating the stub after the
    first call to default_target, so both /etc/fstab and the temporary
    file were being read.  This caused errors when running spec tests on
    platforms where /etc/fstab is unreadable by non-privileged users.
    
    Fixed the problem by moving the stub declaration earlier in the test.

diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb
index 2a305b9..4d654fa 100755
--- a/spec/unit/provider/mount/parsed_spec.rb
+++ b/spec/unit/provider/mount/parsed_spec.rb
@@ -220,6 +220,11 @@ FSTAB
     include ParsedMountTesting
 
     before :each do
+      # Note: we have to stub default_target before creating resources
+      # because it is used by Puppet::Type::Mount.new to populate the
+      # :target property.
+      @provider.stubs(:default_target).returns fake_fstab
+
       @res_ghost = Puppet::Type::Mount.new(:name => '/ghost')    # in no fake fstab
       @res_mounted = Puppet::Type::Mount.new(:name => '/')       # in every fake fstab
       @res_unmounted = Puppet::Type::Mount.new(:name => '/boot') # in every fake fstab
@@ -232,7 +237,6 @@ FSTAB
       end
 
       @provider.stubs(:mountcmd).returns File.read(fake_mountoutput)
-      @provider.stubs(:default_target).returns fake_fstab
     end
 
     it "should set :ensure to :unmounted if found in fstab but not mounted" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list