diff options
| author | Luke Kanies <luke@madstop.com> | 2007-10-13 14:07:24 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-10-13 14:07:24 -0500 |
| commit | 29feac0cecddc910b74601d0914fa2c83757b10c (patch) | |
| tree | 888305ecde1e4a488304f7e2e169bf1ca38e6d19 /test/network/handler | |
| parent | 74d77f76a012d523430e43f1092609a4ca584cc7 (diff) | |
| download | puppet-29feac0cecddc910b74601d0914fa2c83757b10c.tar.gz puppet-29feac0cecddc910b74601d0914fa2c83757b10c.tar.xz puppet-29feac0cecddc910b74601d0914fa2c83757b10c.zip | |
Translating the report handler to an indirected model.
I've provided backward compatibility with the old
handler.
The only terminus type that currently exists for reports
is the 'code' terminus, which is used to process reports
in the style of the old handler. At some point, we should
likely switch at least some of these report types (e.g., 'store')
to terminus types.
Diffstat (limited to 'test/network/handler')
| -rwxr-xr-x | test/network/handler/report.rb | 103 |
1 files changed, 1 insertions, 102 deletions
diff --git a/test/network/handler/report.rb b/test/network/handler/report.rb index ac8cf6fac..76326bce6 100755 --- a/test/network/handler/report.rb +++ b/test/network/handler/report.rb @@ -31,46 +31,13 @@ class TestReportServer < Test::Unit::TestCase client end - def test_report_autoloading - # Create a fake report - fakedir = tempfile() - $: << fakedir - cleanup do $:.delete(fakedir) end - - libdir = File.join(fakedir, "puppet", "reports") - FileUtils.mkdir_p(libdir) - - $myreportrun = false - file = File.join(libdir, "myreport.rb") - File.open(file, "w") { |f| f.puts %{ - Puppet::Network::Handler.report.newreport(:myreport) do - def process(report) - $myreportrun = true - return report - end - end - } - } - Puppet[:reports] = "myreport" - - # Create a server - server = Puppet::Network::Handler.report.new - - report = nil - assert_nothing_raised { - report = Puppet::Network::Handler.report.report(:myreport) - } - assert(report, "Did not get report") - - end - def test_process server = Puppet::Network::Handler.report.new # We have to run multiple reports to make sure there's no conflict reports = [] $run = [] - 5.times do |i| + 2.times do |i| name = "processtest%s" % i reports << name @@ -100,35 +67,6 @@ class TestReportServer < Test::Unit::TestCase } end - # Make sure reports can specify whether to use yaml or not - def test_useyaml - server = Puppet::Network::Handler.report.new - - Report.newreport(:yamlyes, :useyaml => true) do - def process(report) - $yamlyes = :yesyaml - end - end - - Report.newreport(:yamlno) do - def process - $yamlno = :noyaml - end - end - - Puppet[:reports] = "yamlyes, yamlno" - - report = fakereport - yaml = YAML.dump(report) - - assert_nothing_raised do - server.send(:process, yaml) - end - - assert_equal(:noyaml, $yamlno, "YAML was used for non-yaml report") - assert_equal(:yesyaml, $yamlyes, "YAML was not used for yaml report") - end - def test_reports Puppet[:reports] = "myreport" @@ -142,43 +80,4 @@ class TestReportServer < Test::Unit::TestCase assert_equal(ary, server.send(:reports)) end end - - def test_newreport - name = :newreporttest - assert_nothing_raised do - Report.newreport(name) do - attr_accessor :processed - - def process(report) - @processed = report - end - end - end - - assert(Report.report(name), "Did not get report") - assert_instance_of(Module, Report.report(name)) - - obj = "yay" - obj.extend(Report.report(name)) - - assert_nothing_raised do - obj.process("yay") - end - - assert_equal("yay", obj.processed) - end - - # Make sure we get a list of all reports - def test_report_list - list = nil - assert_nothing_raised do - list = Puppet::Network::Handler.report.reports - end - - [:rrdgraph, :store, :tagmail].each do |name| - assert(list.include?(name), "Did not load %s" % name) - end - end end - - |
