2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe 'instrument_classes' do
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:config) { double(:config) }
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:unicorn_sampler) { double(:unicorn_sampler) }
|
|
|
|
let(:influx_sampler) { double(:influx_sampler) }
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
before do
|
|
|
|
allow(config).to receive(:instrument_method)
|
|
|
|
allow(config).to receive(:instrument_methods)
|
2017-09-10 17:25:29 +05:30
|
|
|
allow(config).to receive(:instrument_instance_method)
|
2017-08-17 22:00:37 +05:30
|
|
|
allow(config).to receive(:instrument_instance_methods)
|
2017-09-10 17:25:29 +05:30
|
|
|
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-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'can autoload and instrument all files' do
|
2017-09-10 17:25:29 +05:30
|
|
|
require_relative '../../config/initializers/8_metrics'
|
2017-08-17 22:00:37 +05:30
|
|
|
expect { instrument_classes(config) }.not_to raise_error
|
|
|
|
end
|
|
|
|
end
|