summaryrefslogtreecommitdiffstats
path: root/test/ral
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-01-14 13:34:06 -0800
committerLuke Kanies <luke@madstop.com>2008-01-14 13:34:06 -0800
commitcfda651f88d12249f29706d2bedbfddce7a2e6f7 (patch)
tree41c57e5e1405691a561b35b1ceac890c6a341ef3 /test/ral
parent488c43771aea482e0212b605bde054bf8cb0533c (diff)
downloadpuppet-cfda651f88d12249f29706d2bedbfddce7a2e6f7.tar.gz
puppet-cfda651f88d12249f29706d2bedbfddce7a2e6f7.tar.xz
puppet-cfda651f88d12249f29706d2bedbfddce7a2e6f7.zip
Another round of test-fixes toward eliminating global resource
references. This should have gotten rid of all of them, and now it's just a question of fixing a few hopefully unrelated failing tests.
Diffstat (limited to 'test/ral')
-rwxr-xr-xtest/ral/providers/group.rb1
-rwxr-xr-xtest/ral/types/cron.rb7
-rwxr-xr-xtest/ral/types/exec.rb9
-rwxr-xr-xtest/ral/types/file.rb11
-rwxr-xr-xtest/ral/types/fileignoresource.rb11
-rwxr-xr-xtest/ral/types/filesources.rb2
-rwxr-xr-xtest/ral/types/group.rb1
-rwxr-xr-xtest/ral/types/host.rb13
-rwxr-xr-xtest/ral/types/tidy.rb2
9 files changed, 5 insertions, 52 deletions
diff --git a/test/ral/providers/group.rb b/test/ral/providers/group.rb
index 18b0866b9..f912ec51a 100755
--- a/test/ral/providers/group.rb
+++ b/test/ral/providers/group.rb
@@ -21,7 +21,6 @@ class TestGroupProvider < Test::Unit::TestCase
def teardown
super
- Puppet.type(:group).clear
@@tmpgroups.each { |group|
unless missing?(group)
remove(group)
diff --git a/test/ral/types/cron.rb b/test/ral/types/cron.rb
index 644494bcc..8e3d25350 100755
--- a/test/ral/types/cron.rb
+++ b/test/ral/types/cron.rb
@@ -25,7 +25,6 @@ class TestCron < Test::Unit::TestCase
def teardown
super
@crontype.defaultprovider = nil
- Puppet::Util::FileType.filetype(:ram).clear
end
def eachprovider
@@ -145,8 +144,6 @@ class TestCron < Test::Unit::TestCase
next unless prop.name.to_s == "command"
assert(prop.insync?(value), "Property %s is not considered in sync with value %s" % [prop.name, value.inspect])
end
-
- @crontype.clear
end
end
@@ -247,7 +244,6 @@ class TestCron < Test::Unit::TestCase
next unless prop.name.to_s == "minute"
assert(prop.insync?(value), "Property %s is not considered in sync with value %s" % [prop.name, value.inspect])
end
- @crontype.clear
end
end
@@ -294,8 +290,6 @@ class TestCron < Test::Unit::TestCase
# Write it to our file
assert_apply(cron)
- @crontype.clear
-
crons = []
assert_nothing_raised {
@crontype.instances.each do |cron|
@@ -484,7 +478,6 @@ class TestCron < Test::Unit::TestCase
cron = @crontype.create(:name => "space testing", :command => string)
assert_apply(cron)
- cron.class.clear
cron = @crontype.create(:name => "space testing", :command => string)
# Now make sure that it's correctly in sync
diff --git a/test/ral/types/exec.rb b/test/ral/types/exec.rb
index 396d27839..976e3f3ab 100755
--- a/test/ral/types/exec.rb
+++ b/test/ral/types/exec.rb
@@ -22,8 +22,6 @@ class TestExec < Test::Unit::TestCase
def test_numvsstring
[0, "0"].each { |val|
- Puppet.type(:exec).clear
- Puppet.type(:component).clear
command = nil
output = nil
assert_nothing_raised {
@@ -50,13 +48,11 @@ class TestExec < Test::Unit::TestCase
:path => "/usr/bin:/bin:/usr/sbin:/sbin"
)
}
- Puppet.type(:exec).clear
assert_nothing_raised {
command = Puppet.type(:exec).create(
:command => "/bin/echo"
)
}
- Puppet.type(:exec).clear
assert_nothing_raised {
command = Puppet.type(:exec).create(
:command => "/bin/echo",
@@ -204,6 +200,7 @@ class TestExec < Test::Unit::TestCase
comp = mk_catalog("Testing", file, exec)
+ Facter.stubs(:to_hash).returns({})
assert_events([:file_created, :executed_command], comp)
end
@@ -353,10 +350,6 @@ class TestExec < Test::Unit::TestCase
if user
assert_equal(user.uid, File.stat(file).uid, "File UIDs do not match")
end
-
- # We can't actually test group ownership, unfortunately, because
- # behaviour changes wildlly based on platform.
- Puppet::Type.allclear
end
def test_userngroup
diff --git a/test/ral/types/file.rb b/test/ral/types/file.rb
index 1d523aa40..aaf007e24 100755
--- a/test/ral/types/file.rb
+++ b/test/ral/types/file.rb
@@ -34,10 +34,10 @@ class TestFile < Test::Unit::TestCase
@file = Puppet::Type.type(:file)
$method = @method_name
Puppet[:filetimeout] = -1
+ Facter.stubs(:to_hash).returns({})
end
def teardown
- Puppet::Util::Storage.clear
system("rm -rf %s" % Puppet[:statefile])
super
end
@@ -420,7 +420,6 @@ class TestFile < Test::Unit::TestCase
of.puts "some more text, yo"
}
}
- Puppet.type(:file).clear
# now recreate the file
assert_nothing_raised() {
@@ -456,11 +455,6 @@ class TestFile < Test::Unit::TestCase
}
assert_events([:file_changed], file)
- # verify that we're actually getting notified when a file changes
- assert_nothing_raised() {
- Puppet.type(:file).clear
- }
-
if path =~ /nonexists/
File.unlink(path)
end
@@ -711,7 +705,6 @@ class TestFile < Test::Unit::TestCase
"Incorrect generated children when recurse == %s" % value.inspect)
File.unlink(tmpfile)
- Puppet.type(:file).clear
end
end
@@ -1330,7 +1323,6 @@ class TestFile < Test::Unit::TestCase
end
assert_equal("/my/file/for/testing", file.title)
- Puppet::Type.type(:file).clear
end
end
@@ -1646,7 +1638,6 @@ class TestFile < Test::Unit::TestCase
assert_nothing_raised("%s conflicted with ensure" % [param]) do
Puppet::Type.newfile(:path => file, param => first, :ensure => :file)
end
- Puppet::Type.type(:file).clear
params.each do |other|
next if other == param
assert_raise(Puppet::Error, "%s and %s did not conflict" % [param, other]) do
diff --git a/test/ral/types/fileignoresource.rb b/test/ral/types/fileignoresource.rb
index ff867c879..996bca424 100755
--- a/test/ral/types/fileignoresource.rb
+++ b/test/ral/types/fileignoresource.rb
@@ -18,6 +18,8 @@ class TestFileIgnoreSources < Test::Unit::TestCase
rescue
system("rm -rf %s" % Puppet[:statefile])
end
+
+ Facter.stubs(:to_hash).returns({})
end
#This is not needed unless using md5 (correct me if I'm wrong)
@@ -86,8 +88,6 @@ class TestFileIgnoreSources < Test::Unit::TestCase
#This file should not
assert(!(FileTest.exists?(File.join(topath,sourcefile2))))
-
- Puppet::Type.allclear
end
def test_ignore_with_wildcard
@@ -155,8 +155,6 @@ class TestFileIgnoreSources < Test::Unit::TestCase
assert(!(FileTest.exists?(File.join(topath,sourcefile2))))
assert(!(FileTest.exists?(File.join(topath,subdir2))))
assert(!(FileTest.exists?(File.join(File.join(topath,subdir),sourcefile2))))
- Puppet::Type.allclear
-
end
def test_ignore_array
@@ -236,10 +234,5 @@ class TestFileIgnoreSources < Test::Unit::TestCase
assert(!(FileTest.exists?(File.join(topath,subdir2))), "subdir2 in dest")
assert(!(FileTest.exists?(File.join(topath,subdir3))), "anotherdir in dest")
assert(!(FileTest.exists?(File.join(File.join(topath,subdir),sourcefile2))), "file2 in dest/sub")
-
-
- Puppet::Type.allclear
-
end
-
end
diff --git a/test/ral/types/filesources.rb b/test/ral/types/filesources.rb
index 511065c45..f21fc9b20 100755
--- a/test/ral/types/filesources.rb
+++ b/test/ral/types/filesources.rb
@@ -21,6 +21,7 @@ class TestFileSources < Test::Unit::TestCase
@file = Puppet::Type.type(:file)
Puppet[:filetimeout] = -1
Puppet::Util::SUIDManager.stubs(:asuser).yields
+ Facter.stubs(:to_hash).returns({})
end
def teardown
@@ -364,7 +365,6 @@ class TestFileSources < Test::Unit::TestCase
end
def recursive_source_test(fromdir, todir)
- Puppet::Type.allclear
initstorage
tofile = nil
trans = nil
diff --git a/test/ral/types/group.rb b/test/ral/types/group.rb
index d28c8eea5..3c29fe505 100755
--- a/test/ral/types/group.rb
+++ b/test/ral/types/group.rb
@@ -39,7 +39,6 @@ class TestGroup < Test::Unit::TestCase
end
def teardown
- Puppet.type(:group).clear
Puppet::Type.type(:group).defaultprovider = nil
super
end
diff --git a/test/ral/types/host.rb b/test/ral/types/host.rb
index 19bc6b4bd..d44fe888c 100755
--- a/test/ral/types/host.rb
+++ b/test/ral/types/host.rb
@@ -54,19 +54,6 @@ class TestHost < Test::Unit::TestCase
return host
end
- def test_list
- assert_nothing_raised do
- @hosttype.defaultprovider.prefetch
- end
-
- count = 0
- @hosttype.each do |h|
- count += 1
- end
-
- assert_equal(0, count, "Found hosts in empty file somehow")
- end
-
# Darwin will actually write to netinfo here.
if Facter.value(:operatingsystem) != "Darwin" or Process.uid == 0
def test_simplehost
diff --git a/test/ral/types/tidy.rb b/test/ral/types/tidy.rb
index 60fad6516..4e3bb53b7 100755
--- a/test/ral/types/tidy.rb
+++ b/test/ral/types/tidy.rb
@@ -207,8 +207,6 @@ class TestTidy < Test::Unit::TestCase
assert_apply(tidy)
assert(! FileTest.exists?(path), "file did not get tidied")
- tidy.class.clear
-
# Now try one with just an age attribute.
time = Time.now - 10
stat = stub 'stat', :mtime => time, :atime => time, :ftype => "file"