Sha256: bca80207b906b1dff1302e846e689bfee90e09a78790483e29be6b015b5d80d1

Contents?: true

Size: 931 Bytes

Versions: 111

Compression:

Stored size: 931 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

111 entries across 111 versions & 2 rubygems

Version Path
puppet-3.8.7 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.6 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.5 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.4 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.3 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.2 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.1 spec/unit/util/instrumentation/listeners/log_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/util/instrumentation/listeners/log_spec.rb