[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 2.6.5-303-gfcfa26a
Stefan Schulte
stefan.schulte at taunusstein.net
Thu Mar 17 10:46:09 UTC 2011
The following commit has been merged in the upstream branch:
commit f534470221fb97f2d25700f01c3f8c43aef73c26
Author: Stefan Schulte <stefan.schulte at taunusstein.net>
Date: Tue Jan 25 20:45:54 2011 +0100
(#4914) Add specs for modified mount provider
Change specs
- No need to call flush before mounting (explicitly),
because the type and syncothers will to that for us
- Add tests regarding the prefetched mount status
diff --git a/spec/unit/provider/mount_spec.rb b/spec/unit/provider/mount_spec.rb
index b034214..232c559 100755
--- a/spec/unit/provider/mount_spec.rb
+++ b/spec/unit/provider/mount_spec.rb
@@ -19,18 +19,13 @@ describe Puppet::Provider::Mount do
describe Puppet::Provider::Mount, " when mounting" do
- it "should use the 'mountcmd' method to mount" do
- @mounter.stubs(:options).returns(nil)
- @mounter.expects(:mountcmd)
-
- @mounter.mount
+ before :each do
+ @mounter.stubs(:get).with(:ensure).returns(:mounted)
end
- it "should flush before mounting if a flush method exists" do
- @mounter.meta_def(:flush) { }
- @mounter.expects(:flush)
- @mounter.stubs(:mountcmd)
+ it "should use the 'mountcmd' method to mount" do
@mounter.stubs(:options).returns(nil)
+ @mounter.expects(:mountcmd)
@mounter.mount
end
@@ -48,6 +43,23 @@ describe Puppet::Provider::Mount do
@mounter.mount
end
+
+ it "should update the :ensure state to :mounted if it was :unmounted before" do
+ @mounter.expects(:mountcmd)
+ @mounter.stubs(:options).returns(nil)
+ @mounter.expects(:get).with(:ensure).returns(:unmounted)
+ @mounter.expects(:set).with(:ensure => :mounted)
+ @mounter.mount
+ end
+
+ it "should update the :ensure state to :ghost if it was :absent before" do
+ @mounter.expects(:mountcmd)
+ @mounter.stubs(:options).returns(nil)
+ @mounter.expects(:get).with(:ensure).returns(:absent)
+ @mounter.expects(:set).with(:ensure => :ghost)
+ @mounter.mount
+ end
+
end
describe Puppet::Provider::Mount, " when remounting" do
@@ -77,21 +89,42 @@ describe Puppet::Provider::Mount do
describe Puppet::Provider::Mount, " when unmounting" do
+ before :each do
+ @mounter.stubs(:get).with(:ensure).returns(:unmounted)
+ end
+
it "should call the :umount command with the resource name" do
@mounter.expects(:umount).with(@name)
@mounter.unmount
end
+
+ it "should update the :ensure state to :absent if it was :ghost before" do
+ @mounter.expects(:umount).with(@name).returns true
+ @mounter.expects(:get).with(:ensure).returns(:ghost)
+ @mounter.expects(:set).with(:ensure => :absent)
+ @mounter.unmount
+ end
+
+ it "should update the :ensure state to :unmounted if it was :mounted before" do
+ @mounter.expects(:umount).with(@name).returns true
+ @mounter.expects(:get).with(:ensure).returns(:mounted)
+ @mounter.expects(:set).with(:ensure => :unmounted)
+ @mounter.unmount
+ end
+
end
describe Puppet::Provider::Mount, " when determining if it is mounted" do
- it "should parse the results of running the mount command with no arguments" do
- Facter.stubs(:value).returns("whatever")
- @mounter.expects(:mountcmd).returns("")
-
+ it "should query the property_hash" do
+ @mounter.expects(:get).with(:ensure).returns(:mounted)
@mounter.mounted?
end
+ end
+
+ describe Puppet::Provider::Mount, " when prefetching resources" do
+
it "should match ' on /private/var/automount<name>' if the operating system is Darwin" do
Facter.stubs(:value).with("operatingsystem").returns("Darwin")
@mounter.expects(:mountcmd).returns("/dev/whatever on /private/var/automount/\ndevfs on /dev")
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list