~bkerensa/ubuntu/raring/puppet/new-upstream-release

« back to all changes in this revision

Viewing changes to spec/integration/configurer_spec.rb

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2011-07-25 01:00:37 UTC
  • mfrom: (1.1.24 upstream) (3.1.25 sid)
  • Revision ID: james.westby@ubuntu.com-20110725010037-875vuxs10eboqgw3
Tags: 2.7.1-1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - debian/puppetmaster-passenger.postinst: Use cacrl instead of hostcrl to
    set the location of the CRL in apache2 configuration. Fix apache2
    configuration on upgrade as well (LP: #641001)
  - move all puppet dependencies to puppet-common since all the code
    actually located in puppet-common.
  - move libagueas from a recommend to a dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env ruby
2
 
 
3
 
require File.dirname(__FILE__) + '/../spec_helper'
 
1
#!/usr/bin/env rspec
 
2
require 'spec_helper'
4
3
 
5
4
require 'puppet/configurer'
6
5
 
34
33
    it "should send a transaction report with valid data" do
35
34
 
36
35
      @configurer.stubs(:save_last_run_summary)
37
 
      Puppet::Transaction::Report.indirection.expects(:save).with do |x, report|
 
36
      Puppet::Transaction::Report.indirection.expects(:save).with do |report, x|
38
37
        report.time.class == Time and report.logs.length > 0
39
38
      end
40
39
 
45
44
 
46
45
    it "should save a correct last run summary" do
47
46
      report = Puppet::Transaction::Report.new("apply")
48
 
      report.stubs(:save)
 
47
      Puppet::Transaction::Report.indirection.stubs(:save)
49
48
 
50
49
      Puppet[:lastrunfile] = tmpfile("lastrunfile")
51
50
      Puppet[:report] = true
52
51
 
 
52
      # We only record integer seconds in the timestamp, and truncate
 
53
      # backwards, so don't use a more accurate timestamp in the test.
 
54
      # --daniel 2011-03-07
 
55
      t1 = Time.now.tv_sec
53
56
      @configurer.run :catalog => @catalog, :report => report
 
57
      t2 = Time.now.tv_sec
54
58
 
55
59
      summary = nil
56
60
      File.open(Puppet[:lastrunfile], "r") do |fd|
62
66
        summary.should be_key(key)
63
67
      end
64
68
      summary["time"].should be_key("notify")
65
 
      summary["time"]["last_run"].should >= Time.now.tv_sec
 
69
      summary["time"]["last_run"].should be_between(t1, t2)
66
70
    end
67
71
  end
68
72
end