Add specs to demonstrate that the instances method is currently broken
because it does not take the actual mountstate into account.

As a result running "puppet resource mount" on the commandline will
report every mount that appears in /etc/(v)fstab as unmounted.

Signed-off-by: Stefan Schulte <[email protected]>
---
 spec/unit/provider/mount/parsed_spec.rb |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/spec/unit/provider/mount/parsed_spec.rb 
b/spec/unit/provider/mount/parsed_spec.rb
index cf29bd3..d1a3a91 100755
--- a/spec/unit/provider/mount/parsed_spec.rb
+++ b/spec/unit/provider/mount/parsed_spec.rb
@@ -229,6 +229,34 @@ FSTAB
 
   end
 
+  describe "when calling instances" do
+    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
+      @provider.stubs(:mountcmd).returns File.read(fake_mountoutput)
+      @retrieve = @provider.instances.collect { |prov| {:name => 
prov.get(:name), :ensure => prov.get(:ensure)}}
+    end
+
+    it "should include unmounted resources" do
+      @retrieve.should include(:name => '/boot', :ensure => :unmounted)
+    end
+
+    it "should include mounted resources" do
+      @retrieve.should include(:name => '/', :ensure => :mounted)
+    end
+
+    # After discussion at  http://projects.puppetlabs.com/issues/7300
+    # ghost resources should not be captured in 2.6.x
+    it "should not include ghost resources" do
+      @retrieve.should_not include(:name => '/ghost', :ensure => :ghost)
+    end
+
+  end
+
   describe "when prefetching" do
     include ParsedMountTesting
 
-- 
1.7.5.rc3

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to