summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-03-18 19:25:15 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-03-18 19:25:15 +0000
commit8eddd4bcd23923a166e1ab7d81be1c1f2d341cdf (patch)
treef82d1ae8f6e5910b919e5f5ebe3d9ad3e44ab20c /test
parent2fe9998e0256a39b413d9e73a04ba4e7784ea3e6 (diff)
downloadpuppet-8eddd4bcd23923a166e1ab7d81be1c1f2d341cdf.tar.gz
puppet-8eddd4bcd23923a166e1ab7d81be1c1f2d341cdf.tar.xz
puppet-8eddd4bcd23923a166e1ab7d81be1c1f2d341cdf.zip
More work on #542 -- services in noop now produce noop events so that they can themselves trigger further changes
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2295 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/other/transactions.rb30
1 files changed, 22 insertions, 8 deletions
diff --git a/test/other/transactions.rb b/test/other/transactions.rb
index d9451291e..a075a120e 100755
--- a/test/other/transactions.rb
+++ b/test/other/transactions.rb
@@ -4,6 +4,7 @@ $:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/
require 'puppet'
require 'puppettest'
+require 'mocha'
require 'puppettest/support/resources'
# $Id$
@@ -1090,24 +1091,37 @@ class TestTransactions < Test::Unit::TestCase
def test_noop_with_notify
path = tempfile
epath = tempfile
- file = Puppet::Type.newfile(:path => path, :ensure => :file)
+ spath = tempfile
+ file = Puppet::Type.newfile(:path => path, :ensure => :file,
+ :title => "file")
exec = Puppet::Type.type(:exec).create(:command => "touch %s" % epath,
- :path => ENV["PATH"], :subscribe => file, :refreshonly => true)
+ :path => ENV["PATH"], :subscribe => file, :refreshonly => true,
+ :title => 'exec1')
+ exec2 = Puppet::Type.type(:exec).create(:command => "touch %s" % spath,
+ :path => ENV["PATH"], :subscribe => exec, :refreshonly => true,
+ :title => 'exec2')
Puppet[:noop] = true
assert(file.noop, "file not in noop")
assert(exec.noop, "exec not in noop")
- assert_apply(file, exec)
+ @logs.clear
+ assert_apply(file, exec, exec2)
assert(! FileTest.exists?(path), "Created file in noop")
assert(! FileTest.exists?(epath), "Executed exec in noop")
-
- logs = @logs.dup
- assert_logged(:notice, /should be/, "did not log file change")
- @logs = logs
- assert_logged(:notice, /Would have triggered/, "did not log exec trigger")
+ assert(! FileTest.exists?(spath), "Executed second exec in noop")
+
+ assert(@logs.detect { |l|
+ l.message =~ /should be/ and l.source == file.property(:ensure).path},
+ "did not log file change")
+ assert(@logs.detect { |l|
+ l.message =~ /Would have/ and l.source == exec.path },
+ "did not log first exec trigger")
+ assert(@logs.detect { |l|
+ l.message =~ /Would have/ and l.source == exec2.path },
+ "did not log second exec trigger")
end
def test_only_stop_purging_with_relations