debian-mirror-gitlab/spec/lib/gitlab/rugged_instrumentation_spec.rb

28 lines
631 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::RuggedInstrumentation, :request_store do
2019-10-12 21:52:04 +05:30
subject { described_class }
describe '.query_time' do
it 'increments query times' do
2020-06-23 00:09:42 +05:30
subject.add_query_time(0.4510004)
subject.add_query_time(0.3220004)
2019-10-12 21:52:04 +05:30
2020-06-23 00:09:42 +05:30
expect(subject.query_time).to eq(0.773001)
2019-10-12 21:52:04 +05:30
expect(subject.query_time_ms).to eq(773.0)
end
end
2020-03-13 15:44:24 +05:30
describe '.increment_query_count' do
2019-10-12 21:52:04 +05:30
it 'tracks query counts' do
expect(subject.query_count).to eq(0)
2.times { subject.increment_query_count }
expect(subject.query_count).to eq(2)
end
end
end