summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-04-04 05:53:13 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-04-04 05:53:13 +0000
commitc8be52b7a9d95c1efcdb8df4ee88ae3f65c6f2df (patch)
treee7ea6aa3dcef56e47c277823f0e4116d6c4823cd /test
parent3327dc809cb645a2e0d81e892c21cf9872f38712 (diff)
downloadpuppet-c8be52b7a9d95c1efcdb8df4ee88ae3f65c6f2df.tar.gz
puppet-c8be52b7a9d95c1efcdb8df4ee88ae3f65c6f2df.tar.xz
puppet-c8be52b7a9d95c1efcdb8df4ee88ae3f65c6f2df.zip
Finally! We now have mount support in OS X. Ouch.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1062 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/types/mount.rb42
1 files changed, 26 insertions, 16 deletions
diff --git a/test/types/mount.rb b/test/types/mount.rb
index 7641fd2cb..64bfa9300 100755
--- a/test/types/mount.rb
+++ b/test/types/mount.rb
@@ -30,8 +30,8 @@ class TestMounts < Test::Unit::TestCase
# but does not modify our actual system.
def mkfaketype
pfile = tempfile()
- old = @mounttype.path
- @mounttype.path = pfile
+ old = @mounttype.filetype
+ @mounttype.filetype = Puppet::FileType.filetype(:ram)
cleanup do
@mounttype.path = old
@@ -123,12 +123,14 @@ class TestMounts < Test::Unit::TestCase
Puppet::Type.type(:mount).retrieve
}
+ oldtype = Puppet::Type.type(:mount).filetype
+
# Now switch to storing in ram
mkfaketype
fs = mkmount
- assert(Puppet::Type.type(:mount).path != "/etc/fstab")
+ assert(Puppet::Type.type(:mount).filetype != oldtype)
assert_events([:mount_created], fs)
@@ -157,22 +159,33 @@ class TestMounts < Test::Unit::TestCase
fs = nil
case Facter["hostname"].value
when "culain": fs = "/ubuntu"
+ when "atalanta": fs = "/mnt"
else
$stderr.puts "No mount for mount testing; skipping"
return
end
- backup = tempfile()
+ assert_nothing_raised {
+ Puppet.type(:mount).retrieve
+ }
+
+ oldtext = Puppet::Type.type(:mount).fileobj.read
- FileUtils.cp(Puppet::Type.type(:mount).path, backup)
+ ftype = Puppet::Type.type(:mount).filetype
# Make sure the original gets reinstalled.
- cleanup do
- FileUtils.cp(backup, Puppet::Type.type(:mount).path)
+ if ftype == Puppet::FileType.filetype(:netinfo)
+ cleanup do
+ IO.popen("niload -r /mounts .", "w") do |file|
+ file.puts oldtext
+ end
+ end
+ else
+ cleanup do
+ Puppet::Type.type(:mount).fileobj.write(oldtext)
+ end
end
- Puppet.type(:mount).retrieve
-
obj = Puppet.type(:mount)[fs]
assert(obj, "Could not retrieve %s object" % fs)
@@ -218,18 +231,14 @@ class TestMounts < Test::Unit::TestCase
assert(text !~ /#{fs}/,
"Fstab still contains %s" % fs)
- assert_raise(Puppet::Error, "Removed mount did not throw an error") {
- obj.mount
- }
-
assert_nothing_raised {
obj[:ensure] = :present
}
assert_events([:mount_created], obj)
- assert(File.read(Puppet.type(:mount).path) =~ /#{fs}/,
- "Fstab does not contain %s" % fs)
+ text = Puppet::Type.type(:mount).fileobj.read
+ assert(text =~ /#{fs}/, "Fstab does not contain %s" % fs)
assert(! obj.mounted?, "Object is mounted incorrectly")
@@ -239,7 +248,8 @@ class TestMounts < Test::Unit::TestCase
assert_events([:mount_mounted], obj)
- assert(File.read(Puppet.type(:mount).path) =~ /#{fs}/,
+ text = Puppet::Type.type(:mount).fileobj.read
+ assert(text =~ /#{fs}/,
"Fstab does not contain %s" % fs)
assert(obj.mounted?, "Object is not mounted")