summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-09-13 02:20:24 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-09-13 02:20:24 +0000
commit58ca9d1241eac3fb982aa673195d5e49ab0a1889 (patch)
tree8515f03f1c1e466ce9d7cee179bc4f4f89e46470 /test
parentf9df5236aa75aa2978c7d9ce826aa6b9bf06a711 (diff)
adding snippet test to verify correct behaviour with missing exec path; also, adding "creates" parameter to exec
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@649 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/language/tc_snippets.rb11
-rwxr-xr-xtest/types/tc_exec.rb35
2 files changed, 29 insertions, 17 deletions
diff --git a/test/language/tc_snippets.rb b/test/language/tc_snippets.rb
index a02b9fa4d..6623affd6 100755
--- a/test/language/tc_snippets.rb
+++ b/test/language/tc_snippets.rb
@@ -341,6 +341,14 @@ class TestSnippets < Test::Unit::TestCase
"File %s is not 755" % file)
end
+ def snippet_missingexecpath(trans)
+ file = "/tmp/exectesting1"
+ execfile = "/tmp/execdisttesting"
+ @@tmpfiles << file
+ @@tmpfiles << execfile
+ assert(!FileTest.exists?(execfile), "File %s exists" % execfile)
+ end
+
def disabled_snippet_dirchmod(trans)
dirs = %w{a b}.collect { |letter|
"/tmp/dirchmodtest%s" % letter
@@ -364,7 +372,8 @@ class TestSnippets < Test::Unit::TestCase
Dir.entries($snippetbase).sort.each { |file|
next if file =~ /^\./
- mname = "snippet_" + file
+
+ mname = "snippet_" + file.sub(/\.pp$/, '')
if self.method_defined?(mname)
#eval("alias %s %s" % [testname, mname])
testname = ("test_" + mname).intern
diff --git a/test/types/tc_exec.rb b/test/types/tc_exec.rb
index bdfebc267..f2a8775b8 100755
--- a/test/types/tc_exec.rb
+++ b/test/types/tc_exec.rb
@@ -1,30 +1,17 @@
if __FILE__ == $0
$:.unshift '..'
$:.unshift '../../lib'
- $puppetbase = "../../../../language/trunk"
+ $puppetbase = "../.."
end
require 'puppet'
+require 'puppettest'
require 'test/unit'
require 'facter'
# $Id$
-class TestExec < Test::Unit::TestCase
- def setup
- Puppet[:loglevel] = :debug if __FILE__ == $0
- @@tmpfiles = []
- end
-
- def teardown
- Puppet::Type.allclear
- @@tmpfiles.each { |f|
- if FileTest.exists?(f)
- system("rm -rf %s" % f)
- end
- }
- end
-
+class TestExec < TestPuppet
def test_execution
command = nil
output = nil
@@ -205,4 +192,20 @@ class TestExec < Test::Unit::TestCase
events
)
end
+
+ def test_creates
+ file = tempfile()
+ exec = nil
+ assert_nothing_raised {
+ exec = Puppet::Type::Exec.new(
+ :command => "touch %s" % file,
+ :path => "/usr/bin:/bin:/usr/sbin:/sbin",
+ :creates => file
+ )
+ }
+
+ comp = newcomp("createstest", exec)
+ assert_events(comp, [:executed_command], "creates")
+ assert_events(comp, [], "creates")
+ end
end