2017-01-23 09:41:32 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-07-10 10:24:02 -04:00
|
|
|
describe 'instrument_classes' do
|
2017-01-23 09:41:32 -05:00
|
|
|
let(:config) { double(:config) }
|
|
|
|
|
2017-07-04 11:28:34 -04:00
|
|
|
let(:unicorn_sampler) { double(:unicorn_sampler) }
|
|
|
|
let(:influx_sampler) { double(:influx_sampler) }
|
|
|
|
|
2017-01-23 09:41:32 -05:00
|
|
|
before do
|
|
|
|
allow(config).to receive(:instrument_method)
|
|
|
|
allow(config).to receive(:instrument_methods)
|
2017-06-14 07:01:38 -04:00
|
|
|
allow(config).to receive(:instrument_instance_method)
|
2017-01-23 09:41:32 -05:00
|
|
|
allow(config).to receive(:instrument_instance_methods)
|
2017-07-04 11:28:34 -04:00
|
|
|
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)
|
2017-01-23 09:41:32 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'can autoload and instrument all files' do
|
2017-07-04 11:28:34 -04:00
|
|
|
require_relative '../../config/initializers/8_metrics'
|
2017-01-23 09:41:32 -05:00
|
|
|
expect { instrument_classes(config) }.not_to raise_error
|
|
|
|
end
|
|
|
|
end
|