BigW Consortium Gitlab

8_metrics_spec.rb 961 Bytes
Newer Older
1 2
require 'spec_helper'

3
describe 'instrument_classes' do
4 5
  let(:config) { double(:config) }

6 7 8
  let(:unicorn_sampler) { double(:unicorn_sampler) }
  let(:influx_sampler) { double(:influx_sampler) }

9 10 11
  before do
    allow(config).to receive(:instrument_method)
    allow(config).to receive(:instrument_methods)
12
    allow(config).to receive(:instrument_instance_method)
13
    allow(config).to receive(:instrument_instance_methods)
14 15 16 17 18
    allow(Gitlab::Metrics::UnicornSampler).to receive(:initialize_instance).and_return(unicorn_sampler)
    allow(Gitlab::Metrics::InfluxSampler).to receive(:initialize_instance).and_return(influx_sampler)
    allow(unicorn_sampler).to receive(:start)
    allow(influx_sampler).to receive(:start)
    allow(Gitlab::Application).to receive(:configure)
19 20 21
  end

  it 'can autoload and instrument all files' do
22
    require_relative '../../config/initializers/8_metrics'
23 24 25
    expect { instrument_classes(config) }.not_to raise_error
  end
end