Paired-with: Jesse Wolfe <[email protected]>
Signed-off-by: Paul Berry <[email protected]>
---
Local-branch: ticket/next/5743
 spec/lib/report_transformer_spec.rb |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/spec/lib/report_transformer_spec.rb 
b/spec/lib/report_transformer_spec.rb
index cd0419d..bb420be 100644
--- a/spec/lib/report_transformer_spec.rb
+++ b/spec/lib/report_transformer_spec.rb
@@ -99,5 +99,37 @@ describe ReportTransformer do
       report = ReportTransformer::OneToTwo.apply(@report)
       @report["status"].should == "unchanged"
     end
+
+    it "should infer configuration version from resource statuses if possible" 
do
+      @report["resource_statuses"].values.each do |resource_status|
+        if resource_status["version"] == 1279826342
+          resource_status["version"] = 12345
+        end
+      end
+      report = ReportTransformer::OneToTwo.apply(@report)
+      @report["configuration_version"].should == '12345'
+    end
+
+    it "should infer configuration version from log objects if not possible 
through resource statuses" do
+      @report["resource_statuses"] = {}
+      @report["logs"].each do |log|
+        if log["version"] == 1279826342
+          log["version"] = 12345
+        end
+      end
+      report = ReportTransformer::OneToTwo.apply(@report)
+      @report["configuration_version"].should == '12345'
+    end
+
+    it "should infer configuration version from log message as a last resort" 
do
+      @report["resource_statuses"] = {}
+      @report["logs"].each do |log|
+        if log["version"] == 1279826342
+          log["version"] = nil
+        end
+      end
+      report = ReportTransformer::OneToTwo.apply(@report)
+      @report["configuration_version"].should == '1279826342'
+    end
   end
 end
-- 
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.

Reply via email to