Some version 1 reports are missing change_count on unchanged resources. Added a test to verify that Dashboard interprets these reports correctly.
Reviewed-by: Nick Lewis <[email protected]> Signed-off-by: Paul Berry <[email protected]> --- Local-branch: maint/next/test_reports_without_change_count spec/lib/puppet/report_spec.rb | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/spec/lib/puppet/report_spec.rb b/spec/lib/puppet/report_spec.rb index 8e2fc31..7954ee2 100644 --- a/spec/lib/puppet/report_spec.rb +++ b/spec/lib/puppet/report_spec.rb @@ -114,10 +114,23 @@ describe Puppet::Transaction::Report do describe "for a format 1 report" do before do - @report = YAML.load_file(Rails.root.join('spec', 'fixtures', 'reports', 'puppet26', 'report_ok_service_started_ok.yaml')) + @yaml_filename = Rails.root.join('spec', 'fixtures', 'reports', 'puppet26', 'report_ok_service_started_ok.yaml') + @report = YAML.load_file(@yaml_filename) @report.extend(ReportExtensions) end + it "should fill in change_count=0 wherever a report is missing change_count attributes" do + report_yaml = File.read(@yaml_filename) + substitutions_performed = report_yaml.gsub!(/^ *change_count: [0-9]+\n/, '') + substitutions_performed.should be_true + @report = YAML.load(report_yaml) + @report.extend(ReportExtensions) + hash = @report.to_hash + hash["resource_statuses"].values.each do |resource_status| + resource_status["change_count"].should == 0 + end + end + it "should produce a hash of the report" do hash = @report.to_hash hash.should be_a(Hash) -- 1.7.2 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
