summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-11-16 22:17:29 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-11-16 22:17:29 +0000
commitc205bf6ba79a905c59eb99747ffe674bbaa11481 (patch)
tree4b045649f13bc4023e7be75185a7c6baa532a3bd /test
parent69600345c1f092cc55320d52e4e75dccc12b1dac (diff)
fixing filesources so that the first found file is copied, and adding a test case
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@745 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rw-r--r--test/puppettest.rb4
-rwxr-xr-xtest/types/filesources.rb31
2 files changed, 34 insertions, 1 deletions
diff --git a/test/puppettest.rb b/test/puppettest.rb
index 20bfb439d..604d95d81 100644
--- a/test/puppettest.rb
+++ b/test/puppettest.rb
@@ -8,6 +8,10 @@ require 'test/unit'
module TestPuppet
def newcomp(name,*ary)
+ if name.is_a?(Puppet::Type)
+ ary.unshift name
+ name = name.name
+ end
comp = Puppet::Type::Component.create(
:name => name
)
diff --git a/test/types/filesources.rb b/test/types/filesources.rb
index b62171202..45cfd3784 100755
--- a/test/types/filesources.rb
+++ b/test/types/filesources.rb
@@ -528,7 +528,7 @@ class TestFileSources < Test::Unit::TestCase
assert(!FileTest.exists?(name), "File with no source exists anyway")
end
- def test_zalwayschecksum
+ def test_alwayschecksum
from = tempfile()
to = tempfile()
@@ -553,6 +553,35 @@ class TestFileSources < Test::Unit::TestCase
assert_equal(0, file.evaluate.length, "File produced changes")
end
+
+ def test_sourcepaths
+ files = []
+ 3.times {
+ files << tempfile()
+ }
+
+ to = tempfile()
+
+ File.open(files[-1], "w") { |f| f.puts "yee-haw" }
+
+ file = nil
+ assert_nothing_raised {
+ file = Puppet::Type::PFile.create(
+ :name => to,
+ :source => files
+ )
+ }
+
+ comp = newcomp(file)
+ assert_events(comp, [:file_changed])
+
+ assert(File.exists?(to), "File does not exist")
+
+ txt = nil
+ File.open(to) { |f| txt = f.read.chomp }
+
+ assert_equal("yee-haw", txt, "Contents do not match")
+ end
end
# $Id$