summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-13 00:47:37 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-13 00:47:37 +0000
commitc7633468d990edc63e32e59521178b30740b7516 (patch)
treeaeed7fda3da5c3c6179a70fd85cd19d204284ad4 /test
parent64d96e9891da508293508491370084d85d977ae7 (diff)
downloadpuppet-c7633468d990edc63e32e59521178b30740b7516.tar.gz
puppet-c7633468d990edc63e32e59521178b30740b7516.tar.xz
puppet-c7633468d990edc63e32e59521178b30740b7516.zip
You can now use the "resources" type to purge resources. I still need to modify transactions so they do not purge resources that have relationships. Also, apparently the noop metaparam was never actually working; now it is, and there is a test for it.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1915 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/types/resources.rb18
-rwxr-xr-xtest/types/type.rb16
2 files changed, 32 insertions, 2 deletions
diff --git a/test/types/resources.rb b/test/types/resources.rb
index f8a2f6640..0cb28377d 100755
--- a/test/types/resources.rb
+++ b/test/types/resources.rb
@@ -82,7 +82,7 @@ class TestResources < Test::Unit::TestCase
purger = nil
assert_nothing_raised do
- purger = @type.create :name => "purgetest"
+ purger = @type.create :name => "purgetest", :noop => true, :loglevel => :warning
end
assert(purger, "did not get purger manager")
@@ -119,10 +119,24 @@ class TestResources < Test::Unit::TestCase
unmanned.each do |u|
assert(! u.managed?, "unmanaged resource was considered managed")
end
+
+ genned = nil
+ assert_nothing_raised do
+ genned = purger.generate
+ end
+ assert(genned, "Did not get any generated resources")
+ assert(! genned.empty?, "generated resource list was empty")
# Now make sure the generate method only finds the unmanaged resources
- assert_equal(unmanned.collect { |r| r.title }.sort, purger.generate.collect { |r| r.title },
+ assert_equal(unmanned.collect { |r| r.title }.sort, genned.collect { |r| r.title },
"Did not return correct purge list")
+
+ # Now make sure our metaparams carried over
+ genned.each do |res|
+ [:noop, :loglevel].each do |param|
+ assert_equal(purger[param], res[param], "metaparam %s did not carry over" % param)
+ end
+ end
end
end
diff --git a/test/types/type.rb b/test/types/type.rb
index 821a9524b..ade0275b8 100755
--- a/test/types/type.rb
+++ b/test/types/type.rb
@@ -758,6 +758,22 @@ end
exec = Puppet::Type.newexec(:title => "yay", :command => "/bin/echo yay")
assert_equal("exec[yay]", exec.ref)
end
+
+ def test_noop_metaparam
+ file = Puppet::Type.newfile :path => tempfile
+ assert(!file.noop, "file incorrectly in noop")
+
+ assert_nothing_raised do
+ file[:noop] = true
+ end
+ assert(file.noop, "file should be in noop")
+
+ # Now set the main one
+ Puppet[:noop] = true
+ assert(file.noop, "file should be in noop")
+ file[:noop] = false
+ assert(file.noop, "file should be in noop")
+ end
end
# $Id$