Commit 4026809d authored by Rajendra Kadam's avatar Rajendra Kadam Committed by Mikołaj Wawrzyniak

Override min/max for nonsql metrics

parent a950f7ac
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::UsageDataNonSqlMetrics do
include UsageDataHelpers
before do
stub_usage_data_connections
end
describe '.uncached_data' do
it 'does not make DB calls' do
recorder = ActiveRecord::QueryRecorder.new do
described_class.uncached_data
end
expect(recorder.count).to eq(74)
end
end
end
...@@ -24,6 +24,12 @@ module Gitlab ...@@ -24,6 +24,12 @@ module Gitlab
def histogram(relation, column, buckets:, bucket_size: buckets.size) def histogram(relation, column, buckets:, bucket_size: buckets.size)
SQL_METRIC_DEFAULT SQL_METRIC_DEFAULT
end end
def maximum_id(model)
end
def minimum_id(model)
end
end end
end end
end end
...@@ -34,4 +34,22 @@ RSpec.describe Gitlab::UsageDataNonSqlMetrics do ...@@ -34,4 +34,22 @@ RSpec.describe Gitlab::UsageDataNonSqlMetrics do
expect(described_class.histogram(JiraImportState.finished, :imported_issues_count, buckets: [], bucket_size: 0)).to eq(default_count) expect(described_class.histogram(JiraImportState.finished, :imported_issues_count, buckets: [], bucket_size: 0)).to eq(default_count)
end end
end end
describe 'min/max methods' do
using RSpec::Parameterized::TableSyntax
where(:model, :result) do
User | nil
Issue | nil
Deployment | nil
Project | nil
end
with_them do
it 'returns nil' do
expect(described_class.minimum_id(model)).to eq(result)
expect(described_class.maximum_id(model)).to eq(result)
end
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment