summaryrefslogtreecommitdiffstats
path: root/test/network/handler
diff options
context:
space:
mode:
Diffstat (limited to 'test/network/handler')
-rwxr-xr-xtest/network/handler/report.rb103
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
-
-