summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-09-06 04:21:55 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-09-06 04:21:55 +0000
commit795a5a0551ba8c2fcf4dcbdb6a3e9ab3fb57bf86 (patch)
tree59c19c3485f93c66e07018667c176f6d0285c2c6 /test
parentf7a5f87cbbbb2a0895e2174ad5d25e6f3f7aad46 (diff)
downloadpuppet-795a5a0551ba8c2fcf4dcbdb6a3e9ab3fb57bf86.tar.gz
puppet-795a5a0551ba8c2fcf4dcbdb6a3e9ab3fb57bf86.tar.xz
puppet-795a5a0551ba8c2fcf4dcbdb6a3e9ab3fb57bf86.zip
adding all of the work necessary for tidying
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@627 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rw-r--r--test/server/tc_bucket.rb2
-rwxr-xr-xtest/types/tc_tidy.rb60
2 files changed, 58 insertions, 4 deletions
diff --git a/test/server/tc_bucket.rb b/test/server/tc_bucket.rb
index 79d8afcd0..0d81474a3 100644
--- a/test/server/tc_bucket.rb
+++ b/test/server/tc_bucket.rb
@@ -172,7 +172,7 @@ class TestBucket < Test::Unit::TestCase
server = nil
client = nil
- port = Puppet::Server::FileBucket::DEFAULTPORT
+ port = Puppet[:masterport]
serverthread = nil
pid = fork {
server = Puppet::Server.new(
diff --git a/test/types/tc_tidy.rb b/test/types/tc_tidy.rb
index 0e6bcd562..748763811 100755
--- a/test/types/tc_tidy.rb
+++ b/test/types/tc_tidy.rb
@@ -45,12 +45,66 @@ class TestTidy < TestPuppet
f.puts rand(100)
}
- Puppet::Type::Tidy.new(
- :name => file
+ tidy = Puppet::Type::Tidy.new(
+ :name => dir,
+ :size => "1b",
+ :recurse => true
)
+
+ comp = newcomp("tidytesting", tidy)
+
+ trans = nil
+ assert_nothing_raised {
+ trans = comp.evaluate
+ }
+ event = nil
+ assert_nothing_raised {
+ event = trans.evaluate.collect { |e| e.event }
+ }
+
+ assert_equal(1, event.length, "Got no events on tidy")
+ assert_equal([:file_tidied], event, "Got incorrect event on tidy")
+
+ assert(!FileTest.exists?(file), "Tidied file still exists")
+ end
+
+ def test_tidydirs
+ dir = mktmpdir
+ file = File.join(dir, "tidytesting")
+ File.open(file, "w") { |f|
+ f.puts rand(100)
+ }
+
+ tidy = Puppet::Type::Tidy.new(
+ :name => dir,
+ :size => "1b",
+ :age => "1s",
+ :rmdirs => true,
+ :recurse => true
+ )
+
+ comp = newcomp("tidytesting", tidy)
+
+ sleep(2)
+ trans = nil
+ assert_nothing_raised {
+ trans = comp.evaluate
+ }
+ event = nil
+ assert_nothing_raised {
+ event = trans.evaluate.collect { |e| e.event }
+ }
+
+ assert(!FileTest.exists?(file), "Tidied %s still exists" % file)
+ assert(!FileTest.exists?(dir), "Tidied %s still exists" % dir)
+
+ assert_equal(2, event.length, "Got %s events instead of %s on tidy" %
+ [event.length, 2])
+ assert_equal([:file_tidied, :file_tidied], event,
+ "Got incorrect events on tidy")
end
- def test_recursion
+ def disabled_test_recursion
source = mktmpdir()
FileUtils.cd(source) {
mkranddirsandfiles()