summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lib/puppettest/support/assertions.rb7
-rw-r--r--test/lib/puppettest/support/utils.rb19
-rwxr-xr-xtest/other/relationships.rb27
-rwxr-xr-xtest/other/transactions.rb35
-rwxr-xr-xtest/ral/type/file/target.rb23
5 files changed, 22 insertions, 89 deletions
diff --git a/test/lib/puppettest/support/assertions.rb b/test/lib/puppettest/support/assertions.rb
index 31fa3f1da..758c126ce 100644
--- a/test/lib/puppettest/support/assertions.rb
+++ b/test/lib/puppettest/support/assertions.rb
@@ -46,7 +46,12 @@ module PuppetTest
config = resources2catalog(*resources)
transaction = Puppet::Transaction.new(config)
- run_events(:evaluate, transaction, events, msg)
+ transaction.evaluate
+ newevents = transaction.events.
+ reject { |e| ['failure', 'audit'].include? e.status }.
+ collect { |e| e.name }
+
+ assert_equal(events, newevents, "Incorrect evaluate #{msg} events")
transaction
end
diff --git a/test/lib/puppettest/support/utils.rb b/test/lib/puppettest/support/utils.rb
index bca5d9634..4ecc3819e 100644
--- a/test/lib/puppettest/support/utils.rb
+++ b/test/lib/puppettest/support/utils.rb
@@ -82,25 +82,6 @@ module PuppetTest::Support::Utils
@mygroup = group
end
- def run_events(type, trans, events, msg)
- case type
- when :evaluate, :rollback # things are hunky-dory
- else
- raise Puppet::DevError, "Incorrect run_events type"
- end
-
- method = type
-
- trans.send(method)
- newevents = trans.events.reject { |e| ['failure', 'audit'].include? e.status }.collect { |e|
- e.name
- }
-
- assert_equal(events, newevents, "Incorrect #{type} #{msg} events")
-
- trans
- end
-
def fakefile(name)
ary = [basedir, "test"]
ary += name.split("/")
diff --git a/test/other/relationships.rb b/test/other/relationships.rb
index 717353c02..e36dcda71 100755
--- a/test/other/relationships.rb
+++ b/test/other/relationships.rb
@@ -14,11 +14,8 @@ 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]
)
}
@@ -58,18 +55,14 @@ class TestRelationships < Test::Unit::TestCase
def test_autorequire
# We know that execs autorequire their cwd, so we'll use that
path = tempfile
-
-
- file = Puppet::Type.type(:file).new(
- :title => "myfile", :path => path,
-
- :ensure => :directory)
-
- exec = Puppet::Type.newexec(
- :title => "myexec", :cwd => path,
-
- :command => "/bin/echo")
-
+ file = Puppet::Type.type(:file).new(
+ :title => "myfile", :path => path,
+ :ensure => :directory
+ )
+ exec = Puppet::Type.newexec(
+ :title => "myexec", :cwd => path,
+ :command => "/bin/echo"
+ )
catalog = mk_catalog(file, exec)
reqs = nil
assert_nothing_raised do
@@ -82,7 +75,7 @@ class TestRelationships < Test::Unit::TestCase
# Now make sure that these relationships are added to the
# relationship graph
catalog.apply do |trans|
- assert(catalog.relationship_graph.edge?(file, exec), "autorequire edge was not created")
+ assert(catalog.relationship_graph.path_between(file, exec), "autorequire edge was not created")
end
end
diff --git a/test/other/transactions.rb b/test/other/transactions.rb
index be8cef483..812e519ab 100755
--- a/test/other/transactions.rb
+++ b/test/other/transactions.rb
@@ -114,39 +114,6 @@ class TestTransactions < Test::Unit::TestCase
assert_equal({inst.title => inst}, $prefetched, "evaluate did not call prefetch")
end
- # We need to generate resources before we prefetch them, else generated
- # resources that require prefetching don't work.
- def test_generate_before_prefetch
- config = mk_catalog
- trans = Puppet::Transaction.new(config)
-
- generate = nil
- prefetch = nil
- trans.expects(:generate).with { |*args| generate = Time.now; true }
- trans.expects(:prefetch).with { |*args| ! generate.nil? }
- trans.prepare
- return
-
- resource = Puppet::Type.type(:file).new :ensure => :present, :path => tempfile
- other_resource = mock 'generated'
- def resource.generate
- [other_resource]
- end
-
-
- config = mk_catalog(yay, rah)
- trans = Puppet::Transaction.new(config)
-
- assert_nothing_raised do
- trans.generate
- end
-
- %w{ya ra y r}.each do |name|
- assert(trans.catalog.vertex?(Puppet::Type.type(:generator)[name]), "Generated #{name} was not a vertex")
- assert($finished.include?(name), "#{name} was not finished")
- end
- end
-
def test_ignore_tags?
config = Puppet::Resource::Catalog.new
config.host_config = true
@@ -235,7 +202,7 @@ class TestTransactions < Test::Unit::TestCase
config = mk_catalog(one, two)
trans = Puppet::Transaction.new(config)
assert_raise(Puppet::Error) do
- trans.prepare
+ trans.evaluate
end
end
diff --git a/test/ral/type/file/target.rb b/test/ral/type/file/target.rb
index 272128586..d778f2891 100755
--- a/test/ral/type/file/target.rb
+++ b/test/ral/type/file/target.rb
@@ -24,12 +24,9 @@ class TestFileTarget < Test::Unit::TestCase
file = nil
assert_nothing_raised {
-
- file = Puppet::Type.type(:file).new(
-
+ file = Puppet::Type.type(:file).new(
:title => "somethingelse",
:ensure => path,
-
:path => link
)
}
@@ -102,12 +99,9 @@ class TestFileTarget < Test::Unit::TestCase
link = nil
assert_nothing_raised {
-
- link = Puppet::Type.type(:file).new(
-
+ link = Puppet::Type.type(:file).new(
:ensure => source,
:path => dest,
-
:recurse => true
)
}
@@ -140,11 +134,8 @@ class TestFileTarget < Test::Unit::TestCase
link = nil
assert_nothing_raised {
-
- link = Puppet::Type.type(:file).new(
-
+ link = Puppet::Type.type(:file).new(
:path => dest,
-
:ensure => "source"
)
}
@@ -161,20 +152,16 @@ class TestFileTarget < Test::Unit::TestCase
resources = []
- resources << Puppet::Type.type(:exec).new(
-
+ resources << Puppet::Type.type(:exec).new(
:command => "mkdir #{source}; touch #{source}/file",
:title => "yay",
-
:path => ENV["PATH"]
)
- resources << Puppet::Type.type(:file).new(
-
+ resources << Puppet::Type.type(:file).new(
:ensure => source,
:path => dest,
:recurse => true,
-
:require => resources[0]
)