summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-10-23 02:43:50 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-10-23 02:43:50 +0000
commitdf8dbbacb09b69c97aee0b76668fd3e56860eb38 (patch)
treefed2356556e0df9bba7bdb24d5b662a8e307e4af /test
parente8912d51f1818bc59015ba687fbbb8a33fe91ecf (diff)
downloadpuppet-df8dbbacb09b69c97aee0b76668fd3e56860eb38.tar.gz
puppet-df8dbbacb09b69c97aee0b76668fd3e56860eb38.tar.xz
puppet-df8dbbacb09b69c97aee0b76668fd3e56860eb38.zip
fixing sources so that they always have a corresponding checksum state
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@728 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rw-r--r--test/puppettest.rb14
-rwxr-xr-xtest/types/filesources.rb26
2 files changed, 38 insertions, 2 deletions
diff --git a/test/puppettest.rb b/test/puppettest.rb
index 3d483d4de..953a065c0 100644
--- a/test/puppettest.rb
+++ b/test/puppettest.rb
@@ -92,13 +92,23 @@ module TestPuppet
end
def tempfile
- f = File.join(self.tmpdir(), self.class.to_s + "testfile" + rand(1000).to_s)
+ if defined? @tmpfilenum
+ @tmpfilenum += 1
+ else
+ @tmpfilenum = 1
+ end
+ f = File.join(self.tmpdir(), self.class.to_s + "testfile" + @tmpfilenum.to_s)
@@tmpfiles << f
return f
end
def testdir
- d = File.join(self.tmpdir(), self.class.to_s + "testdir" + rand(1000).to_s)
+ if defined? @testdirnum
+ @testdirnum += 1
+ else
+ @testdirnum = 1
+ end
+ d = File.join(self.tmpdir(), self.class.to_s + "testdir" + @testdirnum.to_s)
@@tmpfiles << d
return d
end
diff --git a/test/types/filesources.rb b/test/types/filesources.rb
index 46542d76c..98eba2caf 100755
--- a/test/types/filesources.rb
+++ b/test/types/filesources.rb
@@ -527,6 +527,32 @@ class TestFileSources < Test::Unit::TestCase
assert(!FileTest.exists?(name), "File with no source exists anyway")
end
+
+ def test_zalwayschecksum
+ from = tempfile()
+ to = tempfile()
+
+ File.open(from, "w") { |f| f.puts "yayness" }
+ File.open(to, "w") { |f| f.puts "yayness" }
+
+ file = nil
+
+ # Now the files should be exactly the same, so we should not see attempts
+ # at copying
+ assert_nothing_raised {
+ file = Puppet::Type::PFile.create(
+ :path => to,
+ :source => from
+ )
+ }
+
+ file.retrieve
+
+ assert(file.is(:checksum), "File does not have a checksum state")
+
+ assert_equal(0, file.evaluate.length, "File produced changes")
+
+ end
end
# $Id$