summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorMatt Robinson <matt@puppetlabs.com>2010-09-23 16:29:58 -0700
committerMarkus Roberts <Markus@reality.com>2010-09-29 14:12:25 -0700
commite9f9d26ff24f0a951819c5300dbc482fabb0e82d (patch)
tree2d885557790ee0b287ee0d4990709c5168d02a85 /spec/unit
parent34f87cfd74e5c93365da11a5e676f513e8819196 (diff)
[#4783] (#4783) Fix RRDGraph report generation
The code made assumptions about report structure that weren't valid for 2.6.x. The change has been verified to work with 0.25.x and 2.6.x report formats. Paired with: Rein Henrichs
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/indirector/node/active_record_spec.rb1
-rw-r--r--spec/unit/reports/rrdgraph_spec.rb31
2 files changed, 31 insertions, 1 deletions
diff --git a/spec/unit/indirector/node/active_record_spec.rb b/spec/unit/indirector/node/active_record_spec.rb
index 6cc3f5132..3540ef738 100755
--- a/spec/unit/indirector/node/active_record_spec.rb
+++ b/spec/unit/indirector/node/active_record_spec.rb
@@ -3,7 +3,6 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
require 'puppet/node'
-require 'spec/lib/puppet_spec/files.rb'
describe "Puppet::Node::ActiveRecord" do
include PuppetSpec::Files
diff --git a/spec/unit/reports/rrdgraph_spec.rb b/spec/unit/reports/rrdgraph_spec.rb
new file mode 100644
index 000000000..ce2cf7905
--- /dev/null
+++ b/spec/unit/reports/rrdgraph_spec.rb
@@ -0,0 +1,31 @@
+#!/usr/bin/env ruby
+
+Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") }
+
+require 'puppet/reports'
+
+processor = Puppet::Reports.report(:rrdgraph)
+
+describe processor do
+ include PuppetSpec::Files
+ before do
+ Puppet[:rrddir] = tmpdir('rrdgraph')
+ Puppet.settings.use :master
+ end
+
+ after do
+ FileUtils.rm_rf(Puppet[:rrddir])
+ end
+
+ it "should not error on 0.25.x report format" do
+ report = YAML.load_file(File.join(PuppetSpec::FIXTURE_DIR, 'yaml/report0.25.x.yaml')).extend processor
+ report.expects(:mkhtml)
+ lambda{ report.process }.should_not raise_error
+ end
+
+ it "should not error on 2.6.x report format" do
+ report = YAML.load_file(File.join(PuppetSpec::FIXTURE_DIR, 'yaml/report2.6.x.yaml')).extend processor
+ report.expects(:mkhtml)
+ lambda{ report.process }.should_not raise_error
+ end
+end