Sha256: 55b25a7936b04e6b38cd273219bf54cc23bcf1120157402be5f6f08623093bac

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

require File.expand_path('../../common', __FILE__)

require 'drone/metrics/meter'

include Drone

EM.describe 'Meter Metrics' do
  before do
    Drone::init_drone()
    Drone::start_monitoring()
  end
  
  describe "A meter metric with no events" do
    before do
      @meter = Metrics::Meter.new("thangs")
    end

    should "have a count of zero" do
      @meter.count.should == 0
      done
    end

    should "have a mean rate of 0 events/sec" do
      @meter.mean_rate.should == 0.0
      done
    end
    
    should "have a mean rate of zero" do
      @meter.mean_rate.should.be.close?(0, 0.001)
      done
    end
    
    should "have a one-minute rate of zero" do
      @meter.one_minute_rate.should.be.close?(0, 0.001)
      done
    end
    
    should "have a five-minute rate of zero" do
      @meter.five_minutes_rate.should.be.close?(0, 0.001)
      done
    end
    
    should "have a fifteen-minute rate of zero" do
      @meter.fifteen_minutes_rate.should.be.close?(0, 0.001)
      done
    end
  end

  describe "A meter metric with three events" do
    before do
      @meter = Metrics::Meter.new("thangs")
      @meter.mark(3)
    end

    should "have a count of three" do
      @meter.count.should == 3
      done
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
drone-1.0.4 specs/metrics/meter_spec.rb
drone-1.0.1 specs/metrics/meter_spec.rb
drone-0.0.3 specs/metrics/meter_spec.rb
drone-0.0.2 specs/metrics/meter_spec.rb