diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2010-04-07 12:17:19 -0700 |
---|---|---|
committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
commit | 177907935b62fe01e5de182abb6c9c21f2f3bfd4 (patch) | |
tree | aefa73dce31d3ac6c70a89df71118293cbf31073 /test | |
parent | 9154acadf336db7f231df524749f987e885f5b0c (diff) | |
download | puppet-177907935b62fe01e5de182abb6c9c21f2f3bfd4.tar.gz puppet-177907935b62fe01e5de182abb6c9c21f2f3bfd4.tar.xz puppet-177907935b62fe01e5de182abb6c9c21f2f3bfd4.zip |
Remove stale set_trigger
Delete tests that are superceded by specs in "Changing Transaction to
use the new ResourceHarness"
Diffstat (limited to 'test')
-rwxr-xr-x | test/other/transactions.rb | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/test/other/transactions.rb b/test/other/transactions.rb index baf6def18..57aa23432 100755 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -554,103 +554,6 @@ class TestTransactions < Test::Unit::TestCase assert(FileTest.exists?(maker), "Did not make callback file") end - # Yay, this out to be fun. - def test_trigger - $triggered = [] - cleanup { $triggered = nil } - trigger = Class.new do - attr_accessor :name - include Puppet::Util::Logging - def initialize(name) - @name = name - end - def ref - self.name - end - def refresh - $triggered << self.name - end - - def to_s - self.name - end - end - - # Make a graph with some stuff in it. - graph = Puppet::Resource::Catalog.new - - # Add a non-triggering edge. - a = trigger.new(:a) - b = trigger.new(:b) - c = trigger.new(:c) - nope = Puppet::Relationship.new(a, b) - yep = Puppet::Relationship.new(a, c, {:callback => :refresh}) - graph.add_edge(nope) - - # And a triggering one. - graph.add_edge(yep) - - # Create our transaction - trans = Puppet::Transaction.new(graph) - - # Set the non-triggering on - assert_nothing_raised do - trans.set_trigger(nope) - end - - assert(! trans.targeted?(b), "b is incorrectly targeted") - - # Now set the other - assert_nothing_raised do - trans.set_trigger(yep) - end - assert(trans.targeted?(c), "c is not targeted") - - # Now trigger our three resources - assert_nothing_raised do - assert_nil(trans.trigger(a), "a somehow triggered something") - end - assert_nothing_raised do - assert_nil(trans.trigger(b), "b somehow triggered something") - end - assert_equal([], $triggered,"got something in triggered") - result = nil - assert_nothing_raised do - result = trans.trigger(c) - end - assert(result, "c did not trigger anything") - assert_instance_of(Array, result) - event = result.shift - assert_instance_of(Puppet::Transaction::Event, event) - assert_equal(:triggered, event.name, "event was not set correctly") - assert_equal(c, event.source, "source was not set correctly") - - assert(trans.triggered?(c, :refresh), - "Transaction did not store the trigger") - end - - def test_set_target - file = Puppet::Type.type(:file).new(:path => tempfile(), :content => "yay") - exec1 = Puppet::Type.type(:exec).new :command => "/bin/echo exec1" - exec2 = Puppet::Type.type(:exec).new :command => "/bin/echo exec2" - trans = Puppet::Transaction.new(mk_catalog(file, exec1, exec2)) - - # First try it with an edge that has no callback - edge = Puppet::Relationship.new(file, exec1) - assert_nothing_raised { trans.set_trigger(edge) } - assert(! trans.targeted?(exec1), "edge with no callback resulted in a target") - - # Now with an edge that has an unsupported callback - edge = Puppet::Relationship.new(file, exec1, :callback => :nosuchmethod, :event => :ALL_EVENTS) - assert_nothing_raised { trans.set_trigger(edge) } - assert(! trans.targeted?(exec1), "edge with invalid callback resulted in a target") - - # Lastly, with an edge with a supported callback - edge = Puppet::Relationship.new(file, exec1, :callback => :refresh, :event => :ALL_EVENTS) - assert_nothing_raised { trans.set_trigger(edge) } - assert(trans.targeted?(exec1), "edge with valid callback did not result in a target") - end - # Testing #401 -- transactions are calling refresh() on classes that don't support it. def test_callback_availability $called = [] |