summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-12-21 15:43:09 -0800
committerJames Turnbull <james@lovedthanlost.net>2010-01-18 23:21:52 +1100
commit58a81ba0e074ac8b3c6b7f8cd5c59fa18eb7f58a (patch)
tree41d6b2ade75279d879e41259fc52483c7d3bb28c /test
parent282b4b3b469a5b40a671f99e23f7382a433ca944 (diff)
Fixing #1054 - transaction reports are always sent
This refactors how reports, catalogs, configurers, and transactions are all related - the Configurer class manages the report, both creating and sending it, so the transaction is now just responsible for adding data to it. I'm still a bit uncomfortable of the coupling between transactions, the report, and configurer, but it's better than it was. This also fixes #2944 and #2973. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/other/transactions.rb47
1 files changed, 3 insertions, 44 deletions
diff --git a/test/other/transactions.rb b/test/other/transactions.rb
index 6cb772d88..d0c6b8554 100755
--- a/test/other/transactions.rb
+++ b/test/other/transactions.rb
@@ -2,9 +2,9 @@
require File.dirname(__FILE__) + '/../lib/puppettest'
+require 'mocha'
require 'puppet'
require 'puppettest'
-require 'mocha'
require 'puppettest/support/resources'
require 'puppettest/support/utils'
@@ -77,48 +77,6 @@ class TestTransactions < Test::Unit::TestCase
return type
end
- def test_reports
- path1 = tempfile()
- path2 = tempfile()
- objects = []
- objects << Puppet::Type.type(:file).new(
- :path => path1,
- :content => "yayness"
- )
- objects << Puppet::Type.type(:file).new(
- :path => path2,
- :content => "booness"
- )
-
- trans = assert_events([:file_created, :file_created], *objects)
-
- report = nil
-
- assert_nothing_raised {
- report = trans.generate_report
- }
-
- # First test the report logs
- assert(report.logs.length > 0, "Did not get any report logs")
-
- report.logs.each do |obj|
- assert_instance_of(Puppet::Util::Log, obj)
- end
-
- # Then test the metrics
- metrics = report.metrics
-
- assert(metrics, "Did not get any metrics")
- assert(metrics.length > 0, "Did not get any metrics")
-
- assert(metrics.has_key?("resources"), "Did not get object metrics")
- assert(metrics.has_key?("changes"), "Did not get change metrics")
-
- metrics.each do |name, metric|
- assert_instance_of(Puppet::Util::Metric, metric)
- end
- end
-
def test_prefetch
# Create a type just for testing prefetch
name = :prefetchtesting
@@ -574,7 +532,8 @@ class TestTransactions < Test::Unit::TestCase
end
def test_missing_tags?
- resource = stub 'resource', :tagged? => true
+ resource = Puppet::Type.type(:notify).new :title => "foo"
+ resource.stubs(:tagged?).returns true
config = Puppet::Resource::Catalog.new
# Mark it as a host config so we don't care which test is first