summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-01 00:08:05 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-01 00:08:05 +0000
commit54a838e68e52b2eac353d70cb9281ca75d741839 (patch)
tree371e7fb59d2b7116b16984aa70187e646c1ecbc3 /test
parentb8f798f0ad88c990b5f9fe4c2d7b830aeb36a446 (diff)
downloadpuppet-54a838e68e52b2eac353d70cb9281ca75d741839.tar.gz
puppet-54a838e68e52b2eac353d70cb9281ca75d741839.tar.xz
puppet-54a838e68e52b2eac353d70cb9281ca75d741839.zip
Fixing #369. I was not flushing changes to disk when ensure was out of sync. This is going to become a common problem, and should probably be addressed by the framework rather than by individual types, but for now, it works.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2008 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/types/mount.rb28
1 files changed, 23 insertions, 5 deletions
diff --git a/test/types/mount.rb b/test/types/mount.rb
index 1e576070c..949253b5e 100755
--- a/test/types/mount.rb
+++ b/test/types/mount.rb
@@ -29,7 +29,6 @@ class TestMounts < Test::Unit::TestCase
def destroy
@ensure = :absent
- @mounted = false
end
def exists?
@@ -41,15 +40,15 @@ class TestMounts < Test::Unit::TestCase
end
def mounted?
- self.mounted
+ @ensure == :mounted
end
def mount
- self.mounted = true
+ @ensure = :mounted
end
def unmount
- self.mounted = false
+ @ensure = :present
end
end
@@ -123,8 +122,27 @@ class TestMounts < Test::Unit::TestCase
# Now modify a field
mount[:dump] = 2
+ mount[:options] = "defaults,ro"
+
+ assert_events([:mount_changed,:mount_changed], mount)
+ assert_equal(2, mount.provider.dump, "Changes did not get flushed")
+ assert_equal("defaults,ro", mount.provider.options, "Changes did not get flushed")
+
+ # Now modify a field in addition to change :ensure.
+ mount[:ensure] = :present
+ mount[:options] = "defaults"
- assert_events([:mount_changed], mount)
+ assert_apply(mount)
+ assert(! mount.provider.mounted?, "mount was still mounted")
+ assert_equal("defaults", mount.provider.options)
+
+ # Now remount it and make sure changes get flushed then, too.
+ mount[:ensure] = :mounted
+ mount[:options] = "aftermount"
+
+ assert_apply(mount)
+ assert(mount.provider.mounted?, "mount was not mounted")
+ assert_equal("aftermount", mount.provider.options)
end
# Make sure fs mounting behaves appropriately. This is more a test of