Sha256: 5a9f207fee2570d5bc81e41cb3643232719789ad331e1ebe0a9fac20c0fff4f3

Contents?: true

Size: 930 Bytes

Versions: 3

Compression:

Stored size: 930 Bytes

Contents

require 'spec_helper'
require 'puppet/util/instrumentation'

Puppet::Util::Instrumentation.init
log = Puppet::Util::Instrumentation.listener(:log)

describe log do
  before(:each) do
    @log = log.new
  end

  it "should have a notify method" do
    @log.should respond_to(:notify)
  end

  it "should have a data method" do
    @log.should respond_to(:data)
  end

  it "should keep data for stop event" do
    @log.notify(:test, :stop, { :started => Time.at(123456789), :finished => Time.at(123456790)})
    @log.data.should == {:test=>["test took 1.0"]}
  end

  it "should not keep data for start event" do
    @log.notify(:test, :start, { :started => Time.at(123456789)})
    @log.data.should be_empty
  end

  it "should not keep more than 20 events per label" do
    25.times { @log.notify(:test, :stop, { :started => Time.at(123456789), :finished => Time.at(123456790)}) }
    @log.data[:test].size.should == 20
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
puppet-2.7.13 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-2.7.12 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-2.7.11 spec/unit/util/instrumentation/listeners/log_spec.rb