summaryrefslogtreecommitdiffstats
path: root/test/other
diff options
context:
space:
mode:
Diffstat (limited to 'test/other')
-rwxr-xr-xtest/other/relationships.rb18
-rwxr-xr-xtest/other/report.rb8
-rwxr-xr-xtest/other/transactions.rb33
3 files changed, 43 insertions, 16 deletions
diff --git a/test/other/relationships.rb b/test/other/relationships.rb
index e9d3a9376..abdb537a3 100755
--- a/test/other/relationships.rb
+++ b/test/other/relationships.rb
@@ -14,8 +14,11 @@ class TestRelationships < Test::Unit::TestCase
def newfile
assert_nothing_raised() {
- return Puppet::Type.type(:file).new(
+
+ return Puppet::Type.type(:file).new(
+
:path => tempfile,
+
:check => [:mode, :owner, :group]
)
}
@@ -39,8 +42,7 @@ class TestRelationships < Test::Unit::TestCase
sources.each do |source|
targets.each do |target|
edge = deps.find { |e| e.source == source and e.target == target }
- assert(edge, "Could not find edge for %s => %s" %
- [source.ref, target.ref])
+ assert(edge, "Could not find edge for %s => %s" % [source.ref, target.ref])
if refresher
assert_equal(:ALL_EVENTS, edge.event)
@@ -57,9 +59,15 @@ class TestRelationships < Test::Unit::TestCase
# We know that execs autorequire their cwd, so we'll use that
path = tempfile()
- file = Puppet::Type.type(:file).new(:title => "myfile", :path => path,
+
+ file = Puppet::Type.type(:file).new(
+ :title => "myfile", :path => path,
+
:ensure => :directory)
- exec = Puppet::Type.newexec(:title => "myexec", :cwd => path,
+
+ exec = Puppet::Type.newexec(
+ :title => "myexec", :cwd => path,
+
:command => "/bin/echo")
catalog = mk_catalog(file, exec)
diff --git a/test/other/report.rb b/test/other/report.rb
index 9e0a9bbbe..af9ecea81 100755
--- a/test/other/report.rb
+++ b/test/other/report.rb
@@ -21,8 +21,11 @@ class TestReports < Test::Unit::TestCase
# Make every third file
File.open(file, "w") { |f| f.puts "" } if i % 3 == 0
- objects << Puppet::Type.type(:file).new(
+
+ objects << Puppet::Type.type(:file).new(
+
:path => file,
+
:ensure => "file"
)
end
@@ -124,8 +127,7 @@ class TestReports < Test::Unit::TestCase
assert(FileTest.exists?(file), "Did not create rrd file for %s" % type)
daily = file.sub ".rrd", "-daily.png"
- assert(FileTest.exists?(daily),
- "Did not make daily graph for %s" % type)
+ assert(FileTest.exists?(daily), "Did not make daily graph for %s" % type)
end
end
diff --git a/test/other/transactions.rb b/test/other/transactions.rb
index 5c21755fb..5c73f1b9d 100755
--- a/test/other/transactions.rb
+++ b/test/other/transactions.rb
@@ -146,8 +146,7 @@ class TestTransactions < Test::Unit::TestCase
end
%w{ya ra y r}.each do |name|
- assert(trans.catalog.vertex?(Puppet::Type.type(:generator)[name]),
- "Generated %s was not a vertex" % name)
+ assert(trans.catalog.vertex?(Puppet::Type.type(:generator)[name]), "Generated %s was not a vertex" % name)
assert($finished.include?(name), "%s was not finished" % name)
end
end
@@ -323,13 +322,22 @@ class TestTransactions < Test::Unit::TestCase
path = tempfile
epath = tempfile
spath = tempfile
- file = Puppet::Type.type(:file).new(:path => path, :ensure => :file,
+
+ file = Puppet::Type.type(:file).new(
+ :path => path, :ensure => :file,
+
:title => "file")
- exec = Puppet::Type.type(:exec).new(:command => "touch %s" % epath,
+
+ exec = Puppet::Type.type(:exec).new(
+ :command => "touch %s" % epath,
:path => ENV["PATH"], :subscribe => file, :refreshonly => true,
+
:title => 'exec1')
- exec2 = Puppet::Type.type(:exec).new(:command => "touch %s" % spath,
+
+ exec2 = Puppet::Type.type(:exec).new(
+ :command => "touch %s" % spath,
:path => ENV["PATH"], :subscribe => exec, :refreshonly => true,
+
:title => 'exec2')
Puppet[:noop] = true
@@ -347,11 +355,17 @@ class TestTransactions < Test::Unit::TestCase
assert(@logs.detect { |l|
l.message =~ /should be/ and l.source == file.property(:ensure).path},
"did not log file change")
- assert(@logs.detect { |l|
+
+ assert(
+ @logs.detect { |l|
l.message =~ /Would have/ and l.source == exec.path },
+
"did not log first exec trigger")
- assert(@logs.detect { |l|
+
+ assert(
+ @logs.detect { |l|
l.message =~ /Would have/ and l.source == exec2.path },
+
"did not log second exec trigger")
end
@@ -361,7 +375,10 @@ class TestTransactions < Test::Unit::TestCase
3.times do |i|
path = tempfile
paths << path
- file = Puppet::Type.type(:file).new(:path => path, :ensure => :absent,
+
+ file = Puppet::Type.type(:file).new(
+ :path => path, :ensure => :absent,
+
:backup => false, :title => "file%s" % i)
File.open(path, "w") { |f| f.puts "" }
files << file